Commit Graph
2861 Commits
Author SHA1 Message Date
Caolán McNamara 4ba5567cc4 match the package content provider when checking a vnd.sun.star.pkg url
IsExoticProtocol used GetHost() to recover the nested package url of a
vnd.sun.star.pkg url, but the package content provider in
ucb/source/ucp/package/pkguri.cxx uses the whole authority between "://"
and the next '/', which GetHost() truncates at '@'. Check the same
substring the provider does.

The vnd.sun.star.zip branch below already did the equivalent extraction,
so pull the shared parts into a helper that both branches call.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I27be6a839108f2e58d62baefc1a71dcbfc9a4568
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4410
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
(cherry picked from commit ce436efb34d2e0e90ee2cdb450da285530c562f7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206681
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-16 16:14:58 +02:00
Xisco Fauli fb28678005 loplugin:unusedmethods
Change-Id: If3dae53e3cf16df2d0c505a898138dfa6fe6c0f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205442
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-22 09:32:38 +02:00
Stephan Bergmann 811769f009 Consistently use __EMSCRIPTEN__ instead of EMSCRIPTEN macro
...as emsdk 5.0.3 deprecated the predefined EMSCRIPTEN macro (see
<https://github.com/emscripten-core/emscripten/commit/506052bd8b4e23ded7f2351c62ca3b24d40c8cf3>
"Warn about usage of deprecated EMSCRIPTEN macro. NFC (#26381)"), causing
failures like

> In file included from static/source/unoembindhelpers/PrimaryBindings.cxx:29:
> In file included from include/sfx2/viewsh.hxx:35:
> In file included from include/editeng/outliner.hxx:32:
> In file included from include/tools/color.hxx:26:
> include/osl/endian.h:66:15: error: macro 'EMSCRIPTEN' has been marked as deprecated: use __EMSCRIPTEN__ instead [-Werror,-Wdeprecated-pragma]
>    66 | #elif defined EMSCRIPTEN
>       |               ^
> /home/sberg/emsdk/5.0.4/emsdk/emscripten/main/cache/sysroot/include/emscripten/emscripten.h:35:66: note: macro marked 'deprecated' here
>    35 | #pragma clang deprecated(EMSCRIPTEN, "use __EMSCRIPTEN__ instead")
>       |                                                                  ^

To avoid confusion, also suppress the -D$(OS) in
solenv/gbuild/platform/unxgcc.mk that would unnecessarily keep defining
EMSCRIPTEN.

Change-Id: Ic1f187cf1c6417cd95d4092e9cea01a665bd1b2f
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/34
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 50291c2ed83bdb49bb827a4a12905d94b8c42035)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205167
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-05-14 10:11:38 +02:00
Xisco Fauli cfd3309a5d loplugin:unusedmethods
Check existing ones that can be removed

Change-Id: I6ee6fc1772c620ac5d12fea915681b094b7c3bfd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204583
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-04-30 08:54:45 +02:00
Mehul Sharma 32ccbf31d3 tdf#145538 Use range based for loops in uiwriter11.cxx and poly2.cxx
Convert traditional for loops to range based for loops without
changing the existing behaviour of the code.

Change-Id: I118b12572ea1074e5a9aba329cc1acdd06d61666
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202618
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
2026-04-03 14:18:50 +02:00
Noel Grandin ca82a93896 Fraction->double in SfxPoolItem
Change-Id: Ie5fe5f9367c6e657cee20c877a12d4c290aaec94
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202588
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2026-03-24 14:07:52 +01:00
Shoaib Samim bd0d3ea8f0 tdf#168771 Convert enum to enum class in urlobj.cxx
Change-Id: Ia274fa4ef073281f7ef3047f8a2304b8c88d6ccb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202393
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
2026-03-24 06:50:05 +01:00
Noel Grandin 6993d54041 std::lround is unnecessary here
because we are then casting to a type <=32 bits

Change-Id: Ief4a93724ccbae8d697edbd40e4085389d74473f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202156
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-03-19 15:27:43 +01:00
Noel Grandin 8459f0be51 XmlWriter::attribute(double) should actually write a double value
And not truncate it to an integer value.

Add additional overload for attribute that takes an enumerated type, otherwise
the compiler will complain about ambiguous conversion because it cannot
choose between the attribute that takes a integral value and the one that
takes a double value.

Change-Id: I9eae22817ec3b26da7b9468d1c8b5e6f3e900538
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201193
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
2026-03-10 15:49:17 +01:00
Rene Engelhard edfb978cf6 fix build with older boosts (e.g. 1.83)
after af82f165ca

Change-Id: I2ca4757695b1d01a287d7a4e8d48d22455431d12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200864
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Jenkins
2026-03-03 22:31:17 +01:00
Mike Kaganski 35871de09d Set encoding in StartReadingUnicodeText
Simplifies some code. It doesn't make sense to set endianness, but
avoid setting encoding.

Change-Id: I3a09fea7381b6c113075b9800b06b307cdaa6d45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200668
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-02-28 09:49:55 +01:00
Noel Grandin 98174967db SvStream::WriteUniOrByteString should not need to specify encoding
Instead, rely on the stream being set into the correct encoding
during stream initialisation.

Change-Id: If141ba09afe1b04f5d836024975f00e8b20d1447
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200462
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-02-27 07:49:07 +01:00
Noel Grandin d235ca3589 SvStream::ReadUniOrByteString should not need to specify encoding
Instead, rely on the stream being set into the correct encoding
during stream initialisation.

Change-Id: I5b015f12f141a89b176c5a22aeecc4336f0b8f13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200460
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-02-27 07:48:47 +01:00
Noel Grandin 5ad9d928c7 SvStream::WriteUniOrByteChar should not need to specify encoding
Instead, rely on the stream being set into the correct encoding
during stream initialisation.

Change-Id: Ie019e9f7a668b943e418126b14b8bf852a4fa966
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200459
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-02-27 07:48:36 +01:00
Noel Grandin 4e6f8e76bf SvStream::ReadByteStringLine should not need to specify encoding
Instead, rely on the stream being set into the correct encoding
during stream initialisation.

Change-Id: Icceb067e600140589c329429d12add2ef3d471c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200458
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2026-02-26 20:19:02 +01:00
Noel Grandin 3c5f8e3dea SvFileStream::ReadUniOrByteStringLine should not need to specify encoding
Instead, rely on the stream being set into the correct encoding
during stream initialisation.

Change-Id: I96b6818dd07cf4b83959884bcbe3be2cbf90b476
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200457
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2026-02-26 20:18:50 +01:00
Stephan Bergmann af82f165ca Avoid unspecified behavior when checking for "pointer in range"
...which can easily cause wrong behavior.

(Maybe we can eventually replace the use of Boost here with Standard C++, if
something like
<https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3234r1.html> "Utility
to check if a pointer is in a given range" ever gets in.)

Change-Id: I9122efdd3272613b27c33a0d7dbc04ad2d6e39e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200454
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Jenkins
2026-02-26 19:44:18 +01:00
Mike Kaganski 6c89e5a2d2 Use SvStream::DetectEncoding in GetNextChar
... instead of direct use of ucsdet_detect.

Change-Id: If1c523b3b6fd19c2817dfe2cd09e6aa7148de634
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200377
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-02-26 16:58:03 +01:00
Noel Grandin a9503c4cf8 SvFileStream should not need to specify encoding on per-call basis
Starts a process of converting the call-sites of SvFileStream
to just write data, relying on the stream being set
into the correct encoding somewhere during initialisation.

In this commit, I change WriteByteStringLine to do that.
For most of the call sites, they either:
(a) use the stream encoding explicitly
(b) already set the stream to the encoding being used at the call-site

Only in buildFontMenuName did I need to make the stream explicitly
set the stream encoding.

Also add a utility constructor to SvFileStream to make it easy
to set the stream in the correct mode at open-time.
Ideally a stream should be set into the correct encoding
at open time and never changed.

Change-Id: I57afa74807e15320a176a05d43c94c377dad4561
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200289
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-02-26 16:57:00 +01:00
Noel Grandin 9ff0df208b fix pointer arithmetic in SvMemoryStream::PutData
after
  commit fa002b6244
  Author: Noel Grandin <noelgrandin@gmail.com>
  Date:   Sat Feb 21 21:00:32 2026 +0200
  fix asan heap-use-after-free

Change-Id: I2ed04d2957089f2e6968ac63b14639e27709295c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200400
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-02-26 13:50:59 +01:00
Mike Kaganski 55b9d8607b "CharSet" -> "Encoding" in SvStream
Use the correct term. E.g., Unicode charset has different encodings
like UTF-8 and UTF-16, and we mean encoding here.

Change-Id: I65e90b31cda6e39fdb1584b492e6e0b9821865a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200285
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-02-25 10:33:55 +01:00
Mike Kaganski 610168656a Move encoding detection to SvStream
Allows to avoid similar code in SwIoSystem and SfxObjectShell, and
unifies the code.

Change-Id: I16817f2aea5bdabb9bf3505f2f3c2f697e3106e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200284
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-02-25 10:33:49 +01:00
Noel Grandin fa002b6244 fix asan heap-use-after-free
Seems like recent font/pdf related changes have exposed a latent
bug(?) in the SvMemoryStream class. Specifically, writing to
SvMemoryStream using a source pointer that points inside the SvMemoryStream
data buffer causes trouble when the buffer is re-allocated.

Make SvMemoryStream tolerant of this, although it is a rather
dodgy use-case.

READ of size 177 at 0x531000155fe7 thread T0
  SvMemoryStream::PutData(void const*, unsigned long) /tools/source/stream/stream.cxx:1578:5
  SvStream::WriteBytes(void const*, unsigned long) /tools/source/stream/stream.cxx:1195:26
  vcl::filter::PDFDocument::WriteCatalogObject(int, vcl::filter::PDFReferenceElement*&) /vcl/source/filter/ipdf/pdfdocument.cxx:577:27

freed by thread T0 here:
  in SvMemoryStream::FreeMemory() /tools/source/stream/stream.cxx:1694:9
  in SvMemoryStream::ReAllocateMemory(long) /tools/source/stream/stream.cxx:1671:9
  in SvMemoryStream::PutData(void const*, unsigned long) /tools/source/stream/stream.cxx:1569:22
  in SvStream::WriteBytes(void const*, unsigned long) /tools/source/stream/stream.cxx:1195:26
  in vcl::filter::PDFDocument::WriteCatalogObject(int, vcl::filter::PDFReferenceElement*&) /vcl/source/filter/ipdf/pdfdocument.cxx:577:27

Change-Id: I2613ed66cec600b7f44e575a56f6a97c0ff3053d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199959
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-02-25 09:12:11 +01:00
Caolán McNamara b1d0997162 extend exotic protocol list
Change-Id: Ie6df4dd171118ff53596bfc058223ea1f15c9e27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199048
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
2026-02-11 18:28:36 +01:00
Gabor Kelemen c511c65434 tdf#146619 Use more forward declarations in include/tools
Change-Id: Iab2938f82a9fd7ef3334d69c4fd07a9d963a9e24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198237
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
2026-02-01 09:23:01 +01:00
Stephan Bergmann e3ea377f2d Make a virtual function non-inline
...which helps avoid some supposedly spurious -Werror=free-nonheap-object seen
at least with recent GCC 16 trunk,

> In destructor ‘virtual SvLockBytes::~SvLockBytes()’,
>     inlined from ‘void SvRefBase::ReleaseRef()’ at include/tools/ref.hxx:160:36,
>     inlined from ‘tools::SvRef<T>::~SvRef() [with T = writerfilter::rtftok::RTFTokenizer]’ at include/tools/ref.hxx:56:46,
>     inlined from ‘writerfilter::rtftok::RTFLookahead::~RTFLookahead()’ at sw/source/writerfilter/rtftok/rtflookahead.cxx:37:1:
> include/tools/stream.hxx:115:48: error: ‘void operator delete(void*, std::size_t)’ called on pointer ‘((tools::SvRef<writerfilter::rtftok::RTFTokenizer>*)this)[1].tools::SvRef<writerfilter::rtftok::RTFTokenizer>::pObj’ with nonzero offset 56 [-Werror=free-nonheap-object]
>   115 |     virtual ~SvLockBytes() override { close(); }
>       |                                                ^

etc.

Change-Id: I26a599f0e3258e6bf6a4d6e63e559b41029862db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197842
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
2026-01-23 08:04:24 +01:00
Caolán McNamara 180df83664 cid#1677777 Unchecked return value
Change-Id: I0e104a3931164a7ff26a807897327c2aa84011c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196108
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-12-22 22:25:29 +01:00
Caolán McNamara 1b73d2b719 cid#1677775 Variable copied when it could be moved
Change-Id: I3e234ce491f00f23df5f8e59fa2a7a7027ce8a0a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196106
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-12-22 21:11:39 +01:00
Tomaž Vajngerl 99354e5cb0 introduce tools::XPath to be able to reuse the result after call
In tests we many times rerun the XPath search to just check another
XML attribute, or first check the size of child elements and then
check each element's attributes in a separate call (re-running the
XPath search). Re-running an XPath search all the time takes up
quite some CPU resources and doing it a lot will accumulate, so the
idea here is to have an object as a result on which you can reuse
instead of re-running the search.

In addition it is possible to combine the search path from the
previous search, so it is possible to construct paths in a more
concise way.

Example:
auto primitivePath = aXPath.create("/primitive2D");
auto polyPath = aXPath.create(primitivePath, "/polypolygon");

polyPath will use a combined path "/primitive2D/polypolygon"
as the search path.

Checking can be done by simply using CPPUNIT_ASSERT* functions
with this, but we might extend UnoApiXmlTest with some checks
for convenience because the assertXPath methods do have better
reporting when the assert fails. Also integration into the
UnoApiXmlTest class will need to be done, because namespaces need
to be registered before tools::XPath can be used correctly. This
change does not touch that yet.

A couple of tests in SvdrawTest have been changed to use the new
tools::XPath class - most notable testRectangleObject. These tests
don't use any namespaces so it is easy to convert those.

Change-Id: I29251d2e7f4c3ee5b76e46daf78c21d0ca067cb4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195618
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2025-12-22 09:50:21 +01:00
Tor Lillqvist b28a46aa50 Make sure that <tools/UnixWrappers.h> stays compilable as C
We don't use it yet from any C source file, but the plan is to do
that. Mainly from freetype, fontconfig, and cairo, when these are
built for Windows when the --enable-headless options is used (for the
new Collabora Office).

Also some cleanups, sorting #include lines, avoiding warnings, etc.

Change-Id: Ifef3588d06fdcceaeaeb3482399737faaf558d7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195602
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2025-12-15 07:31:21 +01:00
Tomaž Vajngerl ecf75f2637 tools: support XmlWriter construction from xmlTextWriterPtr
So we can use it in dumpAsXml functions and eventually use it as
a replacement to directly using libxml.

Change-Id: I204d487b52343f69224fec2fd480657785bc0a69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195167
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2025-12-08 04:15:21 +01:00
Mike Kaganski 2644351601 Avoid "Entity: line 1: parser error : Document is empty" console noise
Seen when starting with a clean profile.

Change-Id: Ic3cc316a8e4c5e7a4aa817614844ec6886034d29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194275
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-11-20 18:31:44 +01:00
Méven Car 042ffad714 HostFilter: Allow to disable SSL Host verification for allowed hosts
LOK_HOST_ALLOWLIST allows to pass a restricted list of hosts that
curlsession will be allowed to download from.

LOK_HOST_ALLOWLIST_EXEMPT_VERIFY_HOST reuses this list for the use case
of not verifying SSL host additionaly for them. This is useful for say
developpement environement.

Change-Id: I75ac26a4bfe1c33ff183c4ad12391b2da08593cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193961
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit 8688e9d8c94a21a7a0abc9edfe632e6fa0e94281)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194187
Tested-by: Jenkins
Reviewed-by: Méven Car <meven.car@collabora.com>
2025-11-19 13:21:52 +01:00
Tomaž Vajngerl 4fa74cefc3 tools: use string_view instead of OString in XmlWriter
Change-Id: I55dd06fc432d9686b370274a4621d61c035a99dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193997
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2025-11-19 07:33:37 +01:00
Gabor Kelemen fd2e467ba3 tdf#146619 Run IWYU in fw decl mode on include/[a-c]*
After recent commit 851fb75779
recheck these directories in include/ again
to test drive the new --headersfwd mode of bin/find-unneeded-includes

Change-Id: I0ede437c4f9958cd98210ed1760a5b98ea8bd1ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192377
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
2025-11-08 09:37:19 +01:00
Mike Kaganski c9c84aea32 Use group separators to clarify literal designating date
Change-Id: Iecc550d17cb928f46bc3cc594711830c0f0d0ccf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193508
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-11-06 08:08:46 +01:00
Caolán McNamara dfb4cf30d9 cid#1659750 silence Division or modulo by float zero
Change-Id: I8840e0a800292cf0862df301fd7341dfaebff3a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192243
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-10-12 18:17:44 +02:00
Caolán McNamara 293a41d2c0 ofz#446998346 Direct-leak
Direct leak of 392 byte(s) in 1 object(s) allocated from:
  #0 0x5cc5b75ab144 in ___interceptor_malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:67:3
  #1 0x5cc5ba1b928a in _cairo_image_surface_create_for_pixman_image /work/workdir/UnpackedTarball/cairo/src/cairo-image-surface.c:191:15
  #2 0x5cc5ba1b928a in _cairo_image_surface_create_with_pixman_format /work/workdir/UnpackedTarball/cairo/src/cairo-image-surface.c:370:15
  #3 0x5cc5ba200f40 in cairo_surface_create_similar_image /work/workdir/UnpackedTarball/cairo/src/cairo-surface.c:598:10
  #4 0x5cc5b8b16a5c in createTmpCompatibleCairoContext /src/libreoffice/vcl/headless/CairoCommon.cxx:621:31
  #5 0x5cc5b8b16a5c in CairoCommon::getCairoContext(bool, bool) const /src/libreoffice/vcl/headless/CairoCommon.cxx:432:14
  #6 0x5cc5b8b1a473 in CairoCommon::drawPolyPolygon(basegfx::B2DHomMatrix const&, basegfx::B2DPolyPolygon const&, double, bool) /src/libreoffice/vcl/headless/CairoCommon.cxx:959:19
  #7 0x5cc5b8558575 in SalGraphics::DrawPolyPolygon(basegfx::B2DHomMatrix const&, basegfx::B2DPolyPolygon const&, double, OutputDevice const&) /src/libreoffice/vcl/source/gdi/salgdilayout.cxx:499:5
  #8 0x5cc5b81c0ece in OutputDevice::DrawTransparentNatively(tools::PolyPolygon const&, unsigned short) /src/libreoffice/vcl/source/outdev/transparent.cxx:230:25
  #9 0x5cc5b81c0794 in OutputDevice::DrawTransparent(tools::PolyPolygon const&, unsigned short) /src/libreoffice/vcl/source/outdev/transparent.cxx:460:14
  #10 0x5cc5b83629c0 in GDIMetaFile::Play(OutputDevice&, unsigned long) /src/libreoffice/vcl/source/gdi/gdimtf.cxx:374:26

this happens because once a cairo context enters an error state no
functions have an effort on the cairo context.

The error is CAIRO_STATUS_INVALID_MATRIX and the matrix derived
from the polypolygon is degenerate.

The polypolygon contains a polygon with 0 points, which looks invalid,
detect that at import boundary rather than mess around with duplicating
with some with cairo_matrix_invert the invalid matrix at use location.

Change-Id: I3f6a53de3d2638146f969a6f0997c1a58f1669c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192184
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-10-11 15:16:20 +02:00
Caolán McNamara 9b74900076 ofz#442383407 Integer-overflow
Change-Id: I96c62fd03a6c7b4c5e1ddaa62df4bb577fbdb8ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190812
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2025-09-11 18:14:53 +02:00
Mike Kaganski fb022d3ba4 Use less magic numbers
The constexpr function can generate them better

Change-Id: Iff25750a4f20181cca5c42c47884d68933229e74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190807
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2025-09-11 14:55:51 +02:00
Bartosz Kosiorek dea3d83e9a tdf#103859 EMF Improve interpolation of the EMR_ROUNDRECT by Bezier curve
Change-Id: I9d297489415e2b36e9566aa358d5eb9a2e94c398
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190146
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2025-08-27 21:47:26 +02:00
Caolán McNamara be6015e3c4 cid#1659971 silence Overflowed return value
and

cid#1659699 Overflowed return value
cid#1659759 Overflowed return value
cid#1659922 Overflowed return value
cid#1660190 Overflowed return value
cid#1660286 Overflowed return value
cid#1660457 Overflowed return value

Change-Id: Ie9fffe4994b10ed3d4feb14eaf7950e3f01714ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189927
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2025-08-20 15:08:44 +02:00
Caolán McNamara 72e538b9bd tainted_data_return is deprecated
in favour of taint_source, lets drop them all first

Change-Id: I9c4e5c143fcbd6de9491360c993a8ea1b89a726e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189820
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-08-17 15:33:16 +02:00
Caolán McNamara b6db71d04f ofz#437531730 Segv on unknown address
since:

commit 1b68f85903
Date:   Sun Aug 3 01:01:38 2025 +0200

    tdf#167616 EMF Add support for EMR_ANGLEARC record

nPoints can be 0 here

Change-Id: If9aa60e8abbf5e58f5224fe62b84163fbae55448
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189642
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2025-08-15 09:31:52 +02:00
Bartosz Kosiorek ccf1476f70 tdf#103859 EMF Fix quality of EMR_ELLIPSE by using Bazier curve for drawing
Change-Id: I7eaca22dac921229b4a88e07739d379948730bd9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189024
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Tested-by: Jenkins
2025-08-08 17:46:09 +02:00
Alex Berea 4ddabd085a tdf#145759 replaces the defined FSQRT2 with c++ built-in M_SQRT2
Change-Id: I6f27e8cfbfdca9648beffe7d083e22195304d487
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188603
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2025-08-07 20:21:14 +02:00
Bartosz Kosiorek e24f16560d tdf#103859 EMF Fix quality of EMR_ROUNDRECT by using Bazier curve for drawing
As WMF and EMF is using integers and previous EMR_ROUNDRECT implementation
used many small lines to display curves, it produces low quality curves.
With this implementation using Bezier curves,
EMR_ROUNDRECT images are scalable without any loss of quality.

Change-Id: I3ef7f15ed9e3835065030bdf196b9bfa044d84a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189016
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2025-08-06 22:06:09 +02:00
Bartosz Kosiorek 1b68f85903 tdf#167616 EMF Add support for EMR_ANGLEARC record
Change-Id: Ic872f80b2a318ac7c0f3b0cbdb4ad285795989c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188865
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2025-08-06 14:47:01 +02:00
Caolán McNamara 07393eb2cc cid#1659901 silence Logically dead code
Change-Id: I615714cca414e004368bb781b4ed1aacce027a57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188934
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-08-05 12:04:55 +02:00
Caolán McNamara 0246482b6a cid#1659848 silence Logically dead code
and

cid#1660004 Logically dead code
cid#1659644 Logically dead code
cid#1659901 Logically dead code
cid#1660015 Logically dead code

Change-Id: I260149b3f46c86cc7e7c4198242cd3f19cb30f05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188900
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-08-04 12:37:40 +02:00