100 Commits
Author SHA1 Message Date
Caolán McNamara b1df3b5b7a crashtesting: hold the same document BasicManager only once
crash on converting forums/ods/forum-en-39357.ods to xls, and on
recalculating INDIRECT cells in 14 other documents, a debug build
asserts:

 soffice.bin: svl/source/notify/lstner.cxx:83: void SfxListener::StartListening(SfxBroadcaster&, DuplicateHandling): Assertion `!(bListeningAlready && eDuplicateHanding == DuplicateHandling::Unexpected) && "duplicate listener, try building with DBG_UTIL to find the other insert site."' failed.

 #21 SfxListener::StartListening(SfxBroadcaster&, DuplicateHandling) at svl/source/notify/lstner.cxx:83
 #22 SfxBasicManagerHolder::reset(BasicManager*) at sfx2/source/appl/appbaslib.cxx:70
 #23 SfxObjectShell::InitBasicManager_Impl() at sfx2/source/doc/objxtor.cxx:845
 #24 lcl_getBasicManagerForDocument(SfxObjectShell const&) at sfx2/source/doc/objxtor.cxx:656
 #25 SfxObjectShell::GetBasicManager() const at sfx2/source/doc/objxtor.cxx:690
 #26 SfxObjectShell::GetBasic() const at sfx2/source/doc/objxtor.cxx:799
 #27 ScCompiler::ParseMacro(rtl::OUString const&, bool) at sc/source/core/tool/compiler.cxx:3830
 #28 ScCompiler::NextNewToken(bool) at sc/source/core/tool/compiler.cxx:5137
 #29 ScCompiler::CompileString(rtl::OUString const&) at sc/source/core/tool/compiler.cxx:5293
 #30 XclExpChSourceLink::ConvertDataSequence(...) at sc/source/filter/excel/xechart.cxx:901

and the first StartListening of the pair was:

 SfxBasicManagerHolder::reset(BasicManager*) at sfx2/source/appl/appbaslib.cxx:71
 SfxObjectShell::InitBasicManager_Impl() at sfx2/source/doc/objxtor.cxx:845
 lcl_getBasicManagerForDocument(SfxObjectShell const&) at sfx2/source/doc/objxtor.cxx:657
 SfxObjectShell::GetBasicManager() const at sfx2/source/doc/objxtor.cxx:690
 ScServiceProvider::MakeInstance(ScServiceProvider::Type, ScDocShell*) at sc/source/ui/unoobj/servuno.cxx:590
 ScModelObj::createInstance(rtl::OUString const&) at sc/source/ui/unoobj/docuno.cxx:4085
 basic::SfxScriptLibraryContainer::importLibraryElement(...)

Creating the BasicManager of a VBA mode document loads its VBA
document modules, and they create the VBA globals, which asks for
the document's BasicManager again. That nested InitBasicManager_Impl
gets the BasicManager under construction from the repository and
passes it to the holder, then the outer one passes the same one
again, so the holder starts listening to it twice.

That recursion is old, but crashtesting only reaches it since:

commit c8da2d3a99b3a318545f1947f57c929ac9b9a82d
Date:   Sat Sep 26 20:23:11 2026 +0000

    load the Basic project of a VBA mode Calc document after import
    Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13614

Previously the import loaded the Basic project at once and the first
request for the BasicManager came from inside that load. Now with
macros not allowed the project stays unloaded, so the first request
comes later, from a formula, and the load runs inside it.

so make SfxBasicManagerHolder::reset do nothing when it is given the
BasicManager it already holds

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5db2184ae0124879e47310d90b5371e1e2fb0235
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/14516
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit a095496e0d649882531fd8e211ec4179333adee0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211941
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-10-07 12:46:22 +02:00
Caolán McNamara f666a74220 ofz#500542909 svl: don't broadcast an unchanged SetHidden or SetFollow
During import, hidden is set on every page style. Each time, every sheet
using that style is repaginated, which lays out the header and footer
again.

In the fuzzed document those 44 repaginations took 48.75s of its 49s,
and now 1.8s.

SetFollow gets the same check for consistency.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ibdacc93203873d2c6498bf4444d5cc64e929aa83
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/14217
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit d84523bd599f0fabc46ce4f82a6907f938aef55e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211811
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-10-07 08:40:24 +02:00
Caolán McNamara 958f1409e5 note a document event from HTML import like the other HTML events
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I73da657a72b0ac7cb6f58d2cd766a3ab292bf8b1
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13667
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/14076
(cherry picked from commit d5ed5aeaa64aa89329b6350ad254d88c101a8fdc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211799
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-10-06 12:17:50 +02:00
Caolán McNamara e9263897ec ofz#568590554 Integer-overflow
writerfilter::dmapper::BorderHandler::lcl_attribute
 writerfilter::rtftok::RTFReferenceProperties::resolve
 writerfilter::dmapper::DomainMapper::sprmWithProps

\brdrw2147483647 now reaches BorderHandler as 858993458 eighths of a
point, and converting that back to twips overflowed int

regression since:

commit 68c853c46592d3ac4c79d8dede0dd88b5a080b3e
Date:   Wed Sep 23 20:01:06 2026 +0000

    ofz#563849779 Integer-overflow

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5c65ffbcb3cd04a48392f1bbf67509a43914adf3
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/14216
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 24c0fe4de7334a8ccfed18929078fcb48642cba4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211810
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-10-06 09:58:14 +02:00
Caolán McNamara 59caa00aba put refreshing database range imports under the link update control
like area links, sheet links, DDE and data mappings, so the refresh
timer waits until link updates are allowed, and a database range that
re-imports on a refresh delay counts as an external link so the
update links infobar is offered for it

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I470e80249cdbf5c4c65c7888e9873515b238d1a6
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13975
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 783c4ec2b092231fce5e87cb1a7451773cea7018)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211797
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-10-06 09:57:15 +02:00
Caolán McNamara 1440fb4cb8 hsqldb: read textdb.allow_full_path only as a Java system property
as hsqldb 2.x does since 2.1.0

Change-Id: I17101ccd6e8af3adee46644b197d94498b4f32fb
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/13829
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 866cad0af60543757ea2ef5a2c484dc79f20d3d5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211814
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-05 21:18:58 +02:00
Caolán McNamara 3130f90ac9 crashtesting: ClickAction_VANISH missing from translations
seen on converting ooo103896-3.odp to pdf

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5fb08b84fd0b84f704421e0af9a47a8ef34af957
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7232
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 7b41c8b3f607ff8e6bd3a0d6ec23ff481921b9aa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208280
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-05 20:33:14 +02:00
Caolán McNamara e3b0830db3 hsqldb: check an existing lock file rather than taking it over
backport of upstream HSQLDB svn r3155, from the 1.8.1 release

Change-Id: Ide9ff01e0ea589a6676835baf32a8ae09c5234fd
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/13737
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 1d872726606d7cac22934b80e508cbfd8866b870)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211813
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-05 20:32:17 +02:00
Caolán McNamara ab7a107b82 hsqldb: keep the files of an embedded database in a private directory
hsqldb writes its own files next to the database path, and that path was
the document's location. Put each embedded database in a subdirectory
of a directory the driver owns and removes.

Change-Id: I17d2a7e365c51c743d8c359f7b1794b810a8bcc5
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/13818
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 8008e62f8dd6f2b34c35055d070a0b1ecea8826f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211812
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-05 20:32:13 +02:00
Caolán McNamara ca2645b707 dbaccess: use the same script checks as an office document
a database document isn't an SfxObjectShell, so its bound event
scripts run from DocumentEventExecutor rather than from
SfxEvents_Impl::Execute

Change-Id: I72cd173b95301c66c2c10932261bbccbf620c46b
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/11742
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 635a4c0f95b51c108c1ecb723a99fc250a187d61)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211802
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-05 15:39:58 +02:00
Caolán McNamara 4e9a1bf3a8 odbc: quote connection string values that contain a separator
A DSN, user or password with a ";" in it, or starting with "{", gets
split by the driver manager, so put it in braces to pass it as one value.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I14d975c319e65921fe06d8be7125c13fc0b93d77
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/14172
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 690a8a312214cbe154773d287dce8e77f84f62aa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211804
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-10-05 15:31:31 +02:00
Caolán McNamara 194c8298c4 senddoc: pass the mail client its arguments directly
so the generic-mailto and xdg-email branch calls the mail client
with each attachment path as one argument, as the other branches
already do

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Id3fba77ebcb7bb10ef6116c311390a0bdeb412ce
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12783
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/12845
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 0d6a67a081caf933eedb28701079f6576aa3700f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211798
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-05 15:18:00 +02:00
Caolán McNamara 0f2d897059 check the class of a nested user type found by name in SbiImage::Load
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ic9215a25384e07e6c082efbeb3b79dc4b56d158c
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13657
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 48162866845dd588ec0a85a9e9e93ed4477d7771)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211727
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-05 08:56:53 +02:00
Caolán McNamara de88188e2c dbaccess: take JavaDriverClassPath only from the driver configuration
No UI ever wrote this setting into a database document. None of
the (631) .odb files in the crashtesting test corpus have it set.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I3d342f16dbd2d16da8a689a9526d90816967f738
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/14009
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit aae21cae8f686c0f4d43fcbee8b478aae8d60ff1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211722
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-05 08:56:08 +02:00
Caolán McNamara 0eaa944aa5 put calc pivot table database sources under link control
like refreshing database range imports, so a pivot table whose source
is a database document named by URL, rather than a registered data
source, waits until link updates are allowed before it opens it, and
counts as an external link so the update links infobar is offered

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I90a921ef6c4346da53f4cb28f099518221bd87f7
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/14114
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 0d27a2394257fe817160ed4092aecd4168b792e5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211721
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-05 08:55:31 +02:00
Caolán McNamara 4f3909125e only use the form import object when it is a form component
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I38968a0834a044ceb068337fe1d96eb364739019
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13698
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit ed137476afd19a0324bf117fd315b751bfa920c9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211626
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-10-02 09:53:08 +02:00
Caolán McNamara 0e705d4a0b keep each string of a Basic image string pool inside the pool
an image with string offsets outside its pool is not loaded

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I55360ac5f348929f29514982fcf74c7ddb93961e
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13652
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit fc0c18c508cd34bc8a17d534193de8992acdade0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211625
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-02 09:53:03 +02:00
Caolán McNamara ec695f6118 ofz#566727923 refuse a delete whose two ends are not in the same cell
/src/libreoffice/sw/source/core/table/swtable.cxx:2347:73: runtime error: member call on address 0x5ae75cdc3ea0 which does not point to an object of type 'SwNode'
     #0 0x5ae73cde0805 in SwTable::GetTableNode() const /src/libreoffice/sw/source/core/table/swtable.cxx:2347:73
     #1 0x5ae73cddf1d6 in SwTable::SwClientNotify(SwModify const&, SfxHint const&) /src/libreoffice/sw/source/core/table/swtable.cxx:329:39
     #2 0x5ae73be96db9 in SwModify::CallSwClientNotify(SfxHint const&) const /src/libreoffice/sw/source/core/attr/calbck.cxx:276:20
     #3 0x5ae73be96f81 in sw::BroadcastingModify::CallSwClientNotify(SfxHint const&) const /src/libreoffice/sw/source/core/attr/calbck.cxx:297:15
     #4 0x5ae73c389203 in SwDoc::IsUsed(sw::BroadcastingModify const&) const /src/libreoffice/sw/source/core/doc/poolfmt.cxx:108:13
     #5 0x5ae73c472533 in SwDoc::GetUniqueTableName() const /src/libreoffice/sw/source/core/docnode/ndtbl.cxx:4265:38
     #6 0x5ae73c46dc3b in SwDoc::InsertTable(SwInsertTableOptions const&, SwPosition const&, unsigned short, unsigned short, short, SwTableAutoFormat const*, std::__1::vector<unsigned short, std::__1::allocator<unsigned short>> const*, bool, bool, rtl::OUString const&) /src/libreoffice/sw/source/core/docnode/ndtbl.cxx:379:22
     #7 0x5ae73ba4ba51 in WW8TabDesc::CreateSwTable() /src/libreoffice/sw/source/filter/ww8/ww8par2.cxx:2415:30
     #8 0x5ae73ba595f0 in SwWW8ImplReader::StartTable(int) /src/libreoffice/sw/source/filter/ww8/ww8par2.cxx:3428:23

a tracked deletion applied at import ran from one cell to two cells
later, and removed the whole section of the cell between them while
the table still listed that cell

a range that ends in another table, runs into a cell from outside, or
ends in a nested table leaves a box without its cell in the same way

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I1f07e0e1784d88e47feb97bce4490ba3db83e7cb
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13647
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 898c0e4329e20e3bc2988cc1f576bad1074fff4f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211701
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-02 09:51:47 +02:00
Caolán McNamara 04871f8ccf crashtesting: measure HTML form controls without a hidden view
crash on import of bugtrackers/html/novell574949-2.html,
novell574949-3.html and novell688091-3.html, a debug build asserts:

 soffice.bin: include/o3tl/typed_flags_set.hxx:168: constexpr typename o3tl::typed_flags<T>::Wrap operator&(E, E) [with E = SwFrameType; typename o3tl::typed_flags<T>::Wrap = o3tl::is_typed_flags<SwFrameType, 64511>::Wrap]: Assertion `o3tl::detail::isNonNegative( o3tl::to_underlying(lhs))' failed.

and valgrind of novell688091-3.html reports:

 Invalid read of size 4
    at SwFrame::GetType() const (frame.hxx:533)
    by SwFrame::IsContentFrame() const (frame.hxx:1283)
    by SwContentFrame::ImplGetNextContentFrame(bool) const (findfrm.cxx:523)
    by SwContentFrame::GetPrevContentFrame() const (cntfrm.hxx:138)
    by SwFrame::FindPrevCnt_() (findfrm.cxx:1250)
    by SwFrame::FindPrevCnt() const (findfrm.cxx:267)
    by SwTextFrame::IsHiddenNowImpl() const (txtfrm.cxx:1635)
    by SwTextFrame::Prepare(PrepareHint, void const*, bool) (txtfrm.cxx:3047)
    by SwFlyInContentFrame::NotifyBackground(SwPageFrame*, SwRect const&, PrepareHint) (flyincnt.cxx:230)
    by SwFlyInContentFrame::DestroyImpl() (flyincnt.cxx:51)
    by SwLayoutFrame::DestroyImpl() (ssfrm.cxx:509)
    by SwSectionFrame::DestroyImpl() (sectfrm.cxx:192)
    by SwLayoutFrame::DestroyImpl() (ssfrm.cxx:572)
    by SwCellFrame::DestroyImpl() (tabfrm.cxx:6021)
    by SwLayoutFrame::DestroyImpl() (ssfrm.cxx:572)
    by SwRowFrame::DestroyImpl() (tabfrm.cxx:4853)
    by SwTabFrame::DestroyImpl() (tabfrm.cxx:154)
    by SwTableNode::DelFrames(SwRootFrame const*) (ndtbl.cxx:2530)
    by (anonymous namespace)::TableSaveStruct::MakeTable(unsigned short, SwPosition&, SwDoc*) (htmltab.cxx:4754)
    by SwHTMLParser::BuildTable(SvxAdjust, bool, bool, bool) (htmltab.cxx:5167)
  Address 0x2d286d30 is 272 bytes inside a block of size 472 free'd
    at operator delete(void*, unsigned long) (vg_replace_malloc.c:1146)
    by SwSectionFrame::~SwSectionFrame() (sectfrm.cxx:197)
    by SwFrame::DestroyFrame(SwFrame*) (ssfrm.cxx:392)
    by SwLayoutFrame::DestroyImpl() (ssfrm.cxx:572)
    by SwCellFrame::DestroyImpl() (tabfrm.cxx:6021)
    by SwLayoutFrame::DestroyImpl() (ssfrm.cxx:572)
    by SwRowFrame::DestroyImpl() (tabfrm.cxx:4853)
    by SwTabFrame::DestroyImpl() (tabfrm.cxx:154)
    by SwTableNode::DelFrames(SwRootFrame const*) (ndtbl.cxx:2530)
    by (anonymous namespace)::TableSaveStruct::MakeTable(unsigned short, SwPosition&, SwDoc*) (htmltab.cxx:4754)
    by SwHTMLParser::BuildTable(SvxAdjust, bool, bool, bool) (htmltab.cxx:5167)

SetControlSize creates a hidden temporary view to measure a form
control, so a layout exists while the document is still being parsed,
which is an unusual thing to attempt, so it seems easiest to just avoid
that entirely.

The temporary view is originally, since:

commit ff09ed094d
Date:   Mon Jul 7 11:06:22 2008 +0000

    INTEGRATION: CWS ab53 (1.26.112); FILE MERGED 2008/06/20 06:47:28 tkr 1.26.112.1: #i47763# synchronous html import

But svx already had a way to get a control for a plain window with no
view with:

commit e1137040e3
Date:   Tue Nov 14 12:48:07 2006 +0000

    INTEGRATION: CWS aw024 (1.18.138); FILE MERGED ... 2006/03/21 13:20:59 fs 1.18.138.7: #i62854# +GetTemporaryControlForWindow ...

The recent problem only shows up in crashtesting since hidden text
support was added to html filter in:

commit eb9ca728e179aab3f51be4d96b02a03e502a1f87
Date:   Fri Sep 18 08:36:02 2026 +0200

    Related: cool#16219 engine sw HTML import: handle hidden text
    Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12991

so drop the temporary view and realize the control with
GetTemporaryControlForWindow in a hidden window of the parser's own
when there is no view. valgrind is clean on all of these documents,
and the 104 controls in them and in the sw HTML test documents keep
the same sizes.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I47c26c7efba47f747cd1ec29b21350172b1df0c2
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13960
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit c7e0ef4a46fb127962a69b2124de46bc46486685)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211685
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-10-01 22:44:24 +02:00
Caolán McNamara e269db95ff sfx2: start ImportFrom from the same link update state as Load
as ConvertFrom and SwDocShell::Load already do for an initial load, so
links are left alone until UpdateLinks decides what to do with them

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ifbc334736988a8a747f83ef4830cf95cb485a148
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13866
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 8d57e690c64fa6e4385e396d115cc5124ffbf34d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211668
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-01 22:41:40 +02:00
Caolán McNamara 90ff32cc3f ofz#566755881 Out-of-memory
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I07ae0a230816dad69b12474601e600105b97fab6
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13882
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 851a5f7919c538a895ba850f49f5f5210988508e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211666
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-01 16:19:16 +02:00
Caolán McNamara b94e7a82c7 don't preload a password protected library of a document
Preloading it when the library container is created recursed. It gets
loaded along with the document's Basic project instead.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I14b24d93dacdbf856bc9ef5d3e6fa1a885666100
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13616
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit ef186208097f9525e3e376fb8e677c643498f02f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211598
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-01 14:36:21 +02:00
Caolán McNamara b1cbe94512 don't create the BasicManager to warn about Basic on HTML export
Check the library indexes for modules instead, which needs no library
to be loaded.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I49c7de85cc5f473bc69d3077fdf4ba6a77466adf
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13648
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 0bb0a36eb420ff7aafcf0851ff7028b7377407a1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211627
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-01 12:26:13 +02:00
Caolán McNamara 2bc4c7ea19 save the document Basic and dialog libraries without the BasicManager
Store the library containers directly. Creating the BasicManager first
loads the libraries only to save them again.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I056cf4d8549ab5b9ecf31072704bfcd70e13f7e6
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13645
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 358ad5b06facfa12061d94586f66cfbd01ffe4d3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211525
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-01 09:02:56 +02:00
Caolán McNamara a1fa358d47 don't create the document BasicManager on save to check module sizes
Creating it loads every Basic library of the document. Only an
existing BasicManager can have loaded the password protected
modules that the size check looks at.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I1a66c4738d9a91cda785f0603c6f4fd6e6549802
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13628
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 35fb01a50f47698e9b059b75c2a3b88699579fac)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211524
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-30 14:41:13 +02:00
Caolán McNamara 5a201620b2 svg export: check text hyperlink URLs the same way as shape ones
and have the slideshow open only http, https and mailto links

same check as:

commit 34ec465717
Date:   Mon Mar 4 09:38:02 2019 +0100

    Check svg URLs before exporting

text hyperlinks exported since:

commit b76628acb1
Date:   Sat Aug 11 22:23:22 2012 +0200

    text export support for bullets and hyperlinks

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I826ffb43f0e809f91d1728a9a3b39ebec5b83d6e
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13498
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 5f9e522ae9b43a9f4777d86accd20cce02d8fad3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211595
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-30 11:48:43 +02:00
Caolán McNamara f3f25e07f9 ofz#556994536 Null-dereference
\cell can arrive before \intbl, so the buffered cell end has no cell
properties to be replayed with

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ia94d2d7cd3179784db3dcf1bdbf8cf3b7fd2d2de
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/11286
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit cf9a5ad073aa6cac8bb2ad3a24640ee3663b9b41)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211596
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-30 11:35:52 +02:00
Caolán McNamara 6a22c3e9a2 count the boxes of every table in testTableBoxKeepsItsCellSection
so the check can be shared with a document whose damaged table is not
the first one

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I167e1e0dd2373c2ce9c6c233885d851c9c3f7280
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13646
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 1f22e425aabd46f484cdccb85e9784b1d8e32cb0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211599
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-30 10:16:53 +02:00
Caolán McNamara 51744f6265 don't load the document Basic to parse formula names during ODF import
While macros are not yet allowed, a called name is kept as a macro
call if the document has Basic libraries at all.

A cell macro call now decides the macro mode before it loads the
document Basic.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I2f33b51490db8515cd74d5e753bb9a18c5e6a587
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13626
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit d17fd31994d71c28f503bb3cc93471c307756627)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211523
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-30 08:44:12 +02:00
Caolán McNamara 3f2e68ce5f ofz#566780367 Out-of-memory
the stream that collects the parts of a multipart object is writable,
so a seek past its end while reading the object grows it to fit

so read the finished object from a read-only view of the parts written

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0e615e28a7ddd540d84f84e9cf542b29aa68ba57
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13724
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 793c9cfb7fac082ffead5d1726b1e3f92a00090f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211561
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-29 17:00:47 +02:00
Caolán McNamara aa5c21e8b1 start with RawBitmap pixels blanked
so pixels that a reader never writes, for example when it stops a row
early, are black rather than arbitrary noise

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I8e7133427b43447875869d23958dfb4316c4e178
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13725
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit b509e99e049d330950edeac35702735fd22245ab)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211562
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-29 15:57:31 +02:00
Caolán McNamara 5026a97e2e a Java class path entry has to be a plain local file URL
with no host and an absolute path

follow on from "translate only file URLs"
(Change-Id I41076b8af670d673bf29b14c02db0c66744feb0b)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6025f3e627c51d83479e7f79a53841384b326442
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13322
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit cb4680770e2d558fa474fb7d3e3483885941d70a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211548
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-29 14:14:53 +02:00
Caolán McNamara 362360f3fe check the class of a loaded SbxArray and its elements
like the other SBX loaders already do

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Id7989d2b4023c17a29a0fc92b03b574968484b78
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13617
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 1ccef9f52d3132b6917a76f64a697ad0795e5f9f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211531
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-29 08:46:08 +02:00
Caolán McNamara 2399c6b9e5 clear the old value before loading an old format SbxVariable
as the newer format already does

The old format path set the new type without clearing an existing value
first, so the new type bogusly redefined whatever the union still held.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I70d02026d24443ab353be37c0a57685b4e7ac969
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13600
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 27d9427be60d57d3054c01c8806c81b89bd3872d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211530
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-29 08:46:04 +02:00
Caolán McNamara 954442e825 ofz#566458134 Integer-overflow
vcl/source/outdev/ImplMapRes.cxx:190:23: runtime error: signed integer overflow: 0 - -9223372036854775808 cannot be represented in type 'tools::Long' (aka 'long')
     #0 0x5afc86b89af9 in AbsoluteToLocalX vcl/source/outdev/ImplMapRes.cxx:190:23
     #1 0x5afc86b89af9 in ImplMapRes::TransformPointX(long, ImplMapRes const&) const vcl/source/outdev/ImplMapRes.cxx:214:21
     #2 0x5afc862abe28 in OutputDevice::LogicToLogic(Point const&, MapMode const*, MapMode const*) const vcl/source/outdev/map.cxx:991:32
     #3 0x5afc862ab0eb in OutputDevice::SetRelativeMapMode(MapMode const&) vcl/source/outdev/map.cxx:417:16
     #4 0x5afc85733670 in (anonymous namespace)::GraphicExporter::GetGraphic((anonymous namespace)::ExportSettings const&, Graphic&, bool) svx/source/unodraw/UnoGraphicExporter.cxx:909:19

when none of the shapes rendered for a SmartArt fallback has any
content the bound stays empty, and the metafile origin taken from
the minimum of that empty range rounds to LONG_MIN

so start an empty bound at 0,0

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I7f35f6280a882cd5c49de3e411bc0d006cdf9725
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13623
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 47dca3b9edf464297b1cef08a6223885d12efebf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211528
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-29 08:45:42 +02:00
Caolán McNamara 9919c42576 MasterScriptProvider::getScript: match the location to the context exactly
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib569ce5b5a8ccaf56c7922497b920b79a5b7b846
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13658
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit ae5d7f7ce564b4cd4656366ee88afa762e457c8f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211527
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-28 22:25:42 +02:00
Caolán McNamara 5208370de8 ofz#563849779 Integer-overflow
writerfilter::rtftok::RTFDocumentImpl::dispatchValue
 writerfilter::rtftok::RTFDocumentImpl::dispatchValue
 writerfilter::rtftok::RTFTokenizer::dispatchKeyword

\brdrw2147483647 overflowed int converting twips to 1/8 pt

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I150e3d0227e8fd4d6f1125d0c27078f43f1f0f9d
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13414
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 68c853c46592d3ac4c79d8dede0dd88b5a080b3e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211526
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-28 22:04:12 +02:00
Caolán McNamara 148ae71bdf ofz#555964961 Timeout
Timeout in rtf2pdffuzzer, stack sampled with gdb:

 #14 writerfilter::rtftok::RTFDocumentImpl::dispatchDestination at sw/source/writerfilter/rtftok/rtfdispatchdestination.cxx:83
 #15 writerfilter::rtftok::RTFTokenizer::dispatchKeyword at sw/source/writerfilter/rtftok/rtftokenizer.cxx:2190
 #16 writerfilter::rtftok::RTFTokenizer::resolveKeyword at sw/source/writerfilter/rtftok/rtftokenizer.cxx:2146

a \fldinst cut off at the end of the file, before the field name ends,
was scanned for that end forever

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I1210ec48b0cbc333ab58b6662df71a22be8d0391
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13416
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 0b0a478ab8f533eb89dd1267e3d3860b8c62b167)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211455
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-28 16:18:20 +02:00
Caolán McNamara f52c3d3d24 pdf decomposing, widen to fill the textbox don't shrink
My test case got unwanted line wraps

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie9cc9e00560ae91eb32fdeabaf8c2db0f18e5343
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4461
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit aae05668900e7465edc2019666e019608ca3ce7a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209381
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-28 15:53:41 +02:00
Caolán McNamara 370e262391 Related: tdf#163590 apply the autofit scales stored in pptx
A PPTX shape keeps the fit the file was saved with until its text is
edited, and after that it is fitted by our own rules.

The fontScale and lnSpcReduction of a normAutofit never reached the
shape, for three reasons.

Import passed fractions to the TextFitToSizeFontScale and
TextFitToSizeSpacingScale properties, which are percentages.

A missing lnSpcReduction was read as 100000, a full reduction,
instead of 0.

When both properties were set in one setPropertyValues call along
with TextFitToSize, the collected fit item was applied last and
overwrote the scales.

Change-Id: I6b7fcfb6a1822f289f18b8ce77e78526a80f8944
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13539
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit c6938c35aa527883e2fd867f36e22c396601d376)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211506
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-28 14:01:41 +02:00
Caolán McNamara 984bb7858f check the byte ranges of a pdf signature against the file
The offsets and lengths come from the document, so a range that is
not inside the file leaves the signature unchecked now.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I4c293d4c49326cb08336295714dec91d833bbd88
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13334
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 2fb3bbcf0afd5d13f41d526551835a24a0d8b5aa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211454
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-25 19:37:47 +02:00
Caolán McNamara aa74bed8ff consider javascript an exotic protocol
no document feature needs javascript: urls, it defaulted into the
list with the rest in:

commit 7e5feed961ef2344d580d63a5752e9d6e2c0797e
Date:   Fri Aug 21 10:12:08 2026 +0200

    switch INetURLObject::IsExoticProtocol to default-deny

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6546e08af67f00c9783c96dca9c3a736205033ef
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13501
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 6c66678f8ba35fc9b7758a88fa0294fdb871cf1b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211457
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-25 15:54:51 +02:00
Caolán McNamara 46c767daec ofz#523387973 Timeout
Change-Id: Iccc25a6fb069324c271ea0260ca544a6ce84d8b2
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/7271
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 9d51fc581e96737e2460d663e459439c0dd4f396)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211406
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-24 11:29:27 +02:00
Caolán McNamara d3fca73f81 ofz#558289050 Null-dereference
the cast of the text cursor isn't checked, unlike the paragraph
cursor a few lines later

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I11bb7b9ea9f2b22978da57e37edab76d67c0f195
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12356
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit d83c2c6937dcfccf3e59459b78610acdd9aad2d3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211411
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-24 11:01:32 +02:00
Caolán McNamara 37fd5b78b0 ofz#541854037 Timeout
the polygon point counts were checked against the space left in the
whole file, and a small record inside a large file could claim far
more points than it holds

so bound them by the size of the record instead

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0770546d0d48f9b306461da5e9c0117977079483
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12367
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 292bae6e2ee1d8749040b258cd7bf415cf6241b4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211410
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-24 11:01:20 +02:00
Caolán McNamara 8bcb8dc7a9 ofz#559994947 Out-of-memory
the tile data of a tiled PixarLog tiff was truncated, but we zero
fill one short read, so libtiff sized its decode buffer from the
strip geometry and asked for 34GB

the old parser didn't handle tiled images, so don't allow the short
read for them, and cap any single libtiff allocation at the largest
strip we accept

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iebcfa801a20e017c84d0af855e13b22535b362eb
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12360
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit cff709c8107b8ab6b544cf8130ec7a8185501ea5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211409
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-24 11:01:15 +02:00
Caolán McNamara 99e022072c ofz#552117139 Out-of-memory
the count in the file can be far more rectangles than the rest of
the record could hold

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I220e5eb3c5a99f7a7d6114aaa429234fa4a31906
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12357
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit f92f34584421532774a762ec98688db7196badb0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211408
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-24 11:01:11 +02:00
Caolán McNamara a0ffcdfe62 ofz#516227797 Integer-overflow
the fixed-point subtractions reached from _cairo_spline_decompose_into
can overflow, so do the arithmetic in wider types

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6c7d1fa569bfb958ac45ab10748b45acc3ba742d
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12355
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit a1af5f124e9179f74c85feab1b05e7c8f0d73ceb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211407
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-24 11:01:06 +02:00
Caolán McNamara 19c1274daf crashtesting: don't thread a group with an uncalculated dependency
seen on converting forums/xlsx/forum-mso-en4-237685.xlsx to xls and
doing a hard recalculation of the reloaded export, which aborts with:

 soffice.bin: sc/inc/formulacell.hxx:514: void ScFormulaCell::MaybeInterpret():
 Assertion `!rDocument.IsThreadedGroupCalcInProgress()' failed.

 #11 ScFormulaCell::MaybeInterpret at sc/inc/formulacell.hxx:514
 #12 ScFormulaCell::IsEmpty at sc/source/core/data/formulacell.cxx:3218
 #13 ScRefCellValue::hasEmptyValue at sc/source/core/data/cellvalue.cxx:705
 #14 ScInterpreter::Compare at sc/source/core/tool/interpr1.cxx:881
 #15 ScInterpreter::ScNotEqual at sc/source/core/tool/interpr1.cxx:1162
 #16 ScInterpreter::DispatchOpCode at sc/source/core/tool/interpr4.cxx:3852
 #17 ScInterpreter::Interpret at sc/source/core/tool/interpr4.cxx:4414
 #18 ScFormulaCell::InterpretTail at sc/source/core/data/formulacell.cxx:2274
 #19 ScColumn::CalculateInThread at sc/source/core/data/column2.cxx:3270
 #20 ScTable::CalculateInColumnInThread at sc/source/core/data/table1.cxx:2740
 #21 ScDocument::CalculateInColumnInThread at sc/source/core/data/documen8.cxx:421
 #22 Executor::doWork at sc/source/core/data/formulacell.cxx:5541
 #23 comphelper::ThreadTask::exec at comphelper/source/misc/threadpool.cxx:320

lcl_InterpretSpan calculates the first cell of a dirty span with a
group call and the cells after it one at a time, and rechecks only
the cells it calculated one at a time.

The first cell can still be dirty when that call returns. The
dependency walk found a cycle, so the group was rejected, and that is
recorded on the group itself, as mbPartOfCycle and a meCalcState of
GroupCalcDisabled. Interpret then skips InterpretTail, so that only
the group which starts the cycle is calculated.

Both flags sit on the group that was rejected, while lcl_InterpretSpan
looks at the parent group. The bool it gets back says whether a group
interpret was done, not whether this cell was calculated, so the cell
has to be asked.

The rest of the span and the ungrouped cells have been checked for
exactly this since:

commit 4f36f2ccab
Date:   Fri Sep 4 15:51:07 2020 +0200

    detect if a cell still needs interpreting after Interpret()

so check the first cell too, and leave the group to the unthreaded
path when it was left uncalculated

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I3756ed54fbbb9caf48467e0faab5f5cdddb8e5da
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12674
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit e685bd07146af13db00f6b6811b74d2eba297d80)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211379
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-23 19:56:24 +02:00
Caolán McNamara 3ae0b0a194 ofz#515655013 don't remove an emptied table cell section
==1168891==ERROR: AddressSanitizer: heap-use-after-free on address 0x7cc3f9900268
 READ of size 8 at 0x7cc3f9900268 thread T0
     #0 in BigPtrEntry::GetPos() const sw/inc/bparr.hxx:107:5
     #1 in SwNode::GetIndex() const sw/inc/node.hxx:317:57
     #2 in SwTableBox::GetSttIdx() const sw/source/core/table/swtable.cxx:2288:41
     #3 in SwCellFrame::SwCellFrame(SwTableBox const&, SwFrame*, bool) sw/source/core/layout/tabfrm.cxx:5968:37
     #4 in SwRowFrame::SwRowFrame(SwTableLine const&, SwFrame*, bool) sw/source/core/layout/tabfrm.cxx:4822:33
     #5 in SwTabFrame::SwTabFrame(SwTable&, SwFrame*) sw/source/core/layout/tabfrm.cxx:109:32
     #6 in SwTableNode::MakeFrame(SwFrame*) sw/source/core/docnode/ndtbl.cxx:2474:16
     #7 in InsertCnt_(SwLayoutFrame*, SwDoc&, ...) sw/source/core/layout/frmtool.cxx:1735:34
     #8 in SwRootFrame::Init(SwFrameFormat*) sw/source/core/layout/newfrm.cxx:511:5
     #9 in SwViewShell::Init(SwViewOption const*, long) sw/source/core/view/vnew.cxx:143:23

An empty table cell keeps its section because the SwTableBox that owns
the cell points at the start node. Nothing updates
SwTableBox::m_pStartNode, so removing the section leaves the table's
sort array holding a box that points at freed memory.

The ww8 import flushes its redline stack in WW8TabDesc::FinishSwTable
when the table finishes, and a tracked change that continues across a
cell mark gives a range with its two ends in different cells, and
applying it emptied the cell section.

so keep the empty start/end pair only when the table that owns the
cell survives the deletion too

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ia3f9cb45e361095f17a5a544f1efcd2a7465ef3f
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/11630
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit f196f8dfeda9ee0bdc7dc859f456582ddb0ce054)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211378
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-23 19:56:18 +02:00
Caolán McNamara 6041abeaf3 rtftok: add bufferOrSend and use it in singleChar and text
No logic change intended

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I147fc0ef81514e84a932cb422fa3b481d0044dc1
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13061
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit e851ae74cfb8d1d29581ace06cd9ecda741694bc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211336
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-23 00:00:21 +02:00
Caolán McNamara 5c092d96a5 rtftok: test one bRunGroup flag at both ends of the run in text()
so the next commit can replace each buffer-or-send pair there with one
call

no logic change intended

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I07ecac7604e5c9e88511e99828d7804f82eeefa6
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13060
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit b9e0fd5c969b2ad380acc93f2c5266b6e0c56a23)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211335
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-23 00:00:05 +02:00
Caolán McNamara d70ce0c956 rtftok: move the replayBuffer loop body into sendBufferEntry
so a later change can send a single entry directly when there is
no buffer to append it to.

No logic change, git show -w shows the body just moved.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I1aa3579c71eac4c64b538ee3ea6202c5ee40b204
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13059
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 16ae51175817d53f72d5418e1bb3a17e83e48a43)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211334
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-22 23:59:59 +02:00
Caolán McNamara 96efff7b2f rtftok: move the CellEnd break to the top of the replayBuffer loop
no logic change, CellEnd is the only early exit from the loop so
put it on its own ahead of the if/else chain before the rest of the
loop body moves into a function in the next commit

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I9c20449a4780a3b390134a0cc2701d9a07e8d9c5
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13058
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit fe3efbbaefce2a0fb5fa01afcc6f28304d95c1bb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211333
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-22 23:59:55 +02:00
Caolán McNamara a019d1a06f hwp: take the picture link target from inside the follow block
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ifdd88a7949289d1f43e96eb4ecc05720e15d1f57
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12752
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit b47d2063f457d9c85e1b5bc9a76c47fad77de52c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211319
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-22 22:01:26 +02:00
Caolán McNamara 5e82ea09ca emf+: limit the bezier points to what the record holds
The count comes straight from the file, so take the bytes left in the
record as the upper bound on it.

Thanks to Manan Patel (0xManan).

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ia803201408a3f2f886af257941afd33edecebd46
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13225
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 6159c54074e7dbda025f5bf4f6a6a0f8bab26ca7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211317
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-22 20:49:50 +02:00
Caolán McNamara 2bdc2aef5c crashtesting: buffer a shape's end only if its start is buffered
seen on converting interop-test-files/doc/forum-mso-en4-218597.doc to
rtf and reloading the export, which aborts with:

 soffice.bin: sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx:10493:
 void writerfilter::dmapper::DomainMapper_Impl::substream(Id, const
 writerfilter::Reference<writerfilter::Stream>::Pointer_t&):
 Assertion `m_aContextStack.size() == contextSize' failed.

 #12 writerfilter::dmapper::DomainMapper_Impl::substream at engine/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx:10494
 #13 writerfilter::dmapper::DomainMapper::lcl_substream at engine/sw/source/writerfilter/dmapper/DomainMapper.cxx:5039
 #14 writerfilter::LoggedStream::substream at engine/sw/source/writerfilter/dmapper/LoggedResources.cxx:275
 #15 writerfilter::rtftok::RTFDocumentImpl::resolveSubstream at engine/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx:407
 #16 writerfilter::rtftok::RTFDocumentImpl::resolveSubstream at engine/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx:379
 #17 writerfilter::rtftok::RTFDocumentImpl::sectBreak at engine/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx:778
 #18 writerfilter::rtftok::RTFDocumentImpl::dispatchSymbol at engine/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx:217

In the header \intbl makes the table buffer current, so \shptxt buffers
the shape start instead of sending it to the dmapper. A paragraph mark
inside the shape text finds no table properties in that buffer and
decides it is not in a table. Replaying the buffer then sends the start
to the dmapper, and the start pushes a paragraph context.

When the shape text group ends the current buffer is still set, so the
end is appended to the buffer that was just drained. Nothing replays
that buffer again, so the paragraph context stays on the stack and the
header substream ends deeper than it began.

The start and the end have tested the current buffer separately since:

commit 818d80eb0c
Date:   Fri Jun 28 16:47:49 2013 +0200

    RTF import: support shapes inside tables

so remember whether the shape is open in the dmapper, and send its end
there directly when it is

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ifb94f77e3db4d3fcc6041a7927e88c62d9d970a4
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12757
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 306c1f840c413b352940513c83d1498d599b8359)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211313
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-22 18:09:52 +02:00
Caolán McNamara 7934165914 crashtesting: only take the next row when the follow table has one
seen on converting interop-test-files/odt/ooo115853-3.odt to odt,
which faults with:

 #0  SwLayoutFrame::Lower() const (this=0x0) at engine/sw/source/core/inc/layfrm.hxx:103
 #1  SwLayoutFrame::ContainsContent() const (this=0x0) at engine/sw/source/core/layout/findfrm.cxx:107
 #2  GetBodyTextNode at engine/sw/source/core/fields/expfld.cxx:234
 #3  SwChapterField::ChangeExpansion at engine/sw/source/core/fields/chpfld.cxx:145
 #4  SwTextFormatter::NewFieldPortion at engine/sw/source/core/text/txtfld.cxx:113
 ...
 #20 SwViewShell::CalcLayout() at engine/sw/source/core/view/viewsh.cxx:1005
 #21 SwEditShell::CalcLayout() at engine/sw/source/core/edit/edws.cxx:89
 #22 SwXFrame::getPropertyValue at engine/sw/source/core/unocore/unoframe.cxx:2225
 #23 XMLTextParagraphExport::addTextFrameAttributes at engine/xmloff/source/text/txtparae.cxx:2969

A chapter field in the header asks GetBodyTextNode which text node the
page starts with. When the first body content of the page sits in the
repeated headline of a follow table, that headline is a repeat of the
master table's heading, so the code takes the first row after it
instead.

GetFirstNonHeadlineRow returns nothing when the follow holds only
repeated headline rows. The export reaches it in the middle of a
layout calculation, which SwXFrame::getPropertyValue starts in order
to answer a property of a text frame in a table cell.

GetFrameInPage in trvlfrm.cxx does the same step for the same reason
and checks the row it gets. Both callers arrived together,

probably since:

commit a3db03b8d4
Date:   Mon May 3 12:45:37 2004 +0000

    INTEGRATION: CWS gt03 (1.17.22); FILE MERGED 2004/03/11 14:55:03 fme 1.17.22.1: #26165# Feature - Multiple headline rows in tables

so check the row here too, and leave the fallback underneath to take
the content below the header

Not reproduced locally. The odt export runs clean here, under the
crashtest font set and through the harness round trip as well, and the
branch is reached eight times on this document with a row present each
time. Setting that row to null under gdb gives the frames above.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5adb3b9495cfafe11cfa98d701a8ab7476b986bc
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12786
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 653b962592ae7ee257c8b7d28070e95d35cd09e1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211312
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-22 16:17:38 +02:00
Caolán McNamara 2c5fa02813 crashtesting: put the endnote section under the column the text ends in
seen on converting interop-test-files/odt/tdf118553-1.odt, tdf118558-1.odt
and tdf91677-1.odt to doc and reloading the exports

One dies with a stack overflow, SwFrame::InvalidateInfFlags recursing
between a column frame and a body frame that are each other's upper. The
other two abort on the pTmp->IsTabFrame() assertion at
sw/source/core/layout/sectfrm.cxx:2016 in SwFrame::GetNextSctLeaf, reached
through SwFrame::GetNextFootnoteLeaf and SwContentFrame::MoveFootnoteCntFwd.

Every doc import turns on ContinuousEndnotes, so AppendFootnote makes a
section frame for the endnotes at the end of the document and inserts it
into the page's body frame. When the page style has more than one column the
body's lowers are column frames and all the text lives in the column bodies,
so the endnote section became a sibling of the columns. Its next sibling is
then a column frame, which GetNextSctLeaf doesn't expect, and the move it
makes puts a column frame under its own child body frame.

since:

commit 6885dcd7ec
Date:   Tue May 14 08:28:33 2024 +0200

    tdf#160984 sw continuous endnotes: switch to a section-based layout

so work out where the section belongs once, in GetEndNoteSectionUpper, and
let both the insert and GetEndNoteSection ask it

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I474131fca4f74254a5168d79d83ba11116abc692
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12675
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit f29d74eea952d3a9ea90b32afe2c9a8047afc10a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211310
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-22 15:29:29 +02:00
Caolán McNamara b2f721869d firebird: size the setBytes grow check by sqllen
8000 was the default width the hsqldb migration gives a VARBINARY
column, but sqldata is allocated from sqllen, which is less than that
for a narrower column, so test against sqllen instead

since:

commit 54ddc4ff4c
Date:   Sat May 26 18:01:15 2018 +0200

    tdf#117446: FB mig, (VAR)BINARY, fix memory management

Change-Id: I2b55e3842a77f04a4bd0d2ae324b3c4c09988c37
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/12743
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 97419bee2b14ef6a977414f7fece703aa7d2a49c)
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/13046
(cherry picked from commit aa92a88e5e3e397fda345c0701774709b75b44dc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211279
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-22 13:00:26 +02:00
Caolán McNamara 735e195b43 crashtesting: take the start node from the text, not from a cursor
reproduce by converting novell485609-1.doc to odt and loading the
export, which fails with:

 warn:sax:19444:19444:sax/source/fastparser/fastparser.cxx:649: Unexpected exception from XML parser com.sun.star.lang.IllegalArgumentException message: "at sw/source/core/unocore/unotext.cxx:923" ArgumentPosition: 0
 Error: source file could not be loaded

 #0  SwXText::ComparePositions (this=0x55555962dab8, xPos1=..., xPos2=...) at sw/source/core/unocore/unotext.cxx:923
 #1  0x00007fffcb3ae036 in SwXText::compareRegionStarts (this=0x55555962dab8, xRange1=..., xRange2=...) at sw/source/core/unocore/unotext.cxx:965
 #2  0x00007fffe7ec5ccc in InsertFieldmark (rImport=..., rHelper=..., isFieldmarkSeparatorMissing=false) at xmloff/source/text/XMLTextMarkImportContext.cxx:196
 #3  0x00007fffe7ec7743 in XMLTextMarkImportContext::endFastElement (this=0x5555597140d0, nElement=3804281) at xmloff/source/text/XMLTextMarkImportContext.cxx:434
 #4  0x00007fffe7aba6c2 in SvXMLImport::endFastElement (this=0x5555594e8030, Element=3804281) at xmloff/source/core/xmlimp.cxx:1086

CheckForOwnMember made a cursor and took the section node it landed in
as the node this text starts at. createXTextCursor moves forward to
the first content node, so in a cell that starts with a nested table
it lands in that table's first cell.

The fieldmark here is in a paragraph under such a table, so the check
reported it as belonging to some other text.

GetStartNode can be used to do this without a cursor and is apparently
the typical pattern used elsewhere.

see also:

commit 01ce0e62df
Date:   Tue Jun 12 06:28:29 2001 +0000

    #86004#: performance: check cursor position using start node

which moved insertString onto it, so use it here too, the last of
these checks that still makes a cursor

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I57ba4b23308daa1c0f3d6cb64686bce678f72aa6
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13108
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit b88b52f2694ff696e6141add82fc3c89b64243fc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211294
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-21 18:55:34 +02:00
Caolán McNamara 5b42ac7163 ReadLine and ReadUniStringLine: stop at the limit in the loop
the two have drifted apart, so check the limit as each character is
read instead of correcting the count afterwards

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Idad62990843d58dfa13a69667295285ba4c7227f
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12715
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit bbb65e562218787fcc6527aa1e3683017f962eca)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211278
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-21 13:02:57 +02:00
Caolán McNamara aafab1213b Resolves: tdf#172918 allow a media link the user inserts in this session
The document-wide link update permission is decided when the document is
loaded. But media files that the users interactively inserts should be
automatically allowed.

Remember on the media object that the user picked the reference and
allow it on its own, the same way a presentation sound the user picks is
allowed. A reference that arrived with the document still needs the
document-wide permission.

since:

commit f0768394c14f928d47547408fc1195368be81f86
Date:   Tue Jul 14 19:12:01 2026 +0100

    put slideshow media links under link control

see also:

commit 0aa870b7b5a6bda50bab50c7a0a41d28fdf4f6ab
Date:   Wed Jun 17 09:37:23 2026 +0000

    bring external presentation sounds under link management

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/7939
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit 17c0a99a0886b397d5682b87209e34c01fdcd44f)
Change-Id: I711fee12416e3e5e91fc07999ea62df32684b625
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211276
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-21 12:59:37 +02:00
Caolán McNamara f4de60d1b7 skip nspr's test programs on windows and macOS too
nss has had its own NSS_DISABLE_NSPR_TESTS switch since 2024,
https://bugzilla.mozilla.org/show_bug.cgi?id=1904404, so pass that
instead of patching the line out for iOS and Android and skip
the test programs universally.

On windows that skips 161 of nspr's 253 compiled objects and 159 linked test
executables.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I743c3827e33a927961156ee2b3b0f24e5c625b36
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12846
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 5d38d32be65951c2f4cc59df68e2a96c0bac4b61)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211108
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-18 16:16:09 +02:00
Caolán McNamara 449bf4afc0 ShellExec::execute: nothing passes an nFlags of 42 anymore
42 was never a flag value. SystemShellExecuteFlags publishes DEFAULTS 0,
NO_SYSTEM_ERROR_MESSAGE 1 and URIS_ONLY 2, and 42 needs bits 2, 8 and 32. It
was a private signal meaning the parameter is already quoted.

since:

commit c582b21de9
Date:   Wed Jul 11 14:04:25 2007 +0000

    INTEGRATION: CWS stclient (1.16.22); FILE MERGED 2007/07/03 07:43:38 obr 1.16.22.1: #b6573281# the answer to all questions

the only caller arrived the same day in
c61477eea7, a Solaris Service Tags startup job in
framework/source/jobs/shelljob.cxx. It defined the number as
ANSWER_TO_ALL_QUESTIONS and carried the comment explaining it, which is why a
bare 42 was all that was left here.

the job moved to osl_executeProcess in January 2008 in
5629b13246, and the wrapper it drove went in
6b8e02c741, "Kill Sun-specific stclient_wrapper".

unreachable regardless since URIS_ONLY took the value 2 in
d4b67611c4, because 42 & 2 is 2 and so the
URIS_ONLY test above it diverts any caller passing 42.

so always escape the parameter and drop the unused branch

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6f95a0a6a1ff7d39456b999c11f8aa91e36833c0
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12883
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 0e4a3baffc249372706508681977a9c486e4d73f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211109
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-18 16:16:00 +02:00
Caolán McNamara 83740d3d62 sw: start ConvertFrom from the same link update state as SwDocShell::Load
Change-Id: I7f9ad99b1b6daaf49639d62fd83b3603e25a8d1c
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/11114
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 9ee425297d4d6474f3541b04f9e678023c7f0395)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211018
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-17 17:42:01 +02:00
Caolán McNamara d4077c560b use the configured build flags for the zxcvbn-c dictionary generator
every other external gets them, so this one was compiled without
optimisation and it gets used at build time so the lack of optimization
becomes noticable during e.g. our ios build

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ibff6ceaa48ed755747520d0ea90168973b49bbce
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12179
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 8669880f56f6afe92cdc209e3748ea28c27d79e5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211019
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-17 09:02:23 +02:00
Caolán McNamara e8e4c0a88f libxml2: build with cmake's ninja generator on Windows
A: ninja can make use of ccache out of the box
B: ninja participates in the toplevel make job server

The target architecture now comes from the compiler configure selected
instead of the generator's -A.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I86951768ae42a6684b80298ff149af6c8d8d7fb7
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10654
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 29fc77fea92e28dc007781d7f728b67f5b55c58b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210984
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-17 09:02:04 +02:00
Caolán McNamara 949b19a363 crashtesting: keep a page that pdfium cannot read in the import
reproduce by converting the crashtesting document
bitmapreadaccess_getpixelforn24bittcbgr_segmentation_fault.sample,
which is a pdf despite its name, to odg:

 soffice.bin: sd/source/filter/pdf/sdpdffilter.cxx:102: bool ImportPDF(...):
 Assertion `nPageNumber >= 0 && o3tl::make_unsigned(nPageNumber) < aGraphics.size()' failed.

pdfium cannot read three of the five pages here. Both the page size by
index and the page itself fail, so this isn't our size test being too
strict. The file is fuzzed, mutool reports a broken xref and an
invalid object number, and one MediaBox reads
[ 1612934155079108773 0 594 841 ].

ImportPDFUnloaded dropped each page that it couldn't read, so a five
page pdf became a two page Draw document with nothing to say three
pages were lost. The graphics that remained kept their own pdf page
numbers, which then had gaps, and the last one pointed past the end.

Keep an entry for every page the pdf declares. Such a page takes the
size of the last page that did come through, A4 to start, and warns.
It still carries its own page number, so there are no gaps left for
sd to trip over.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Id0d0bde13a2102b4e30cc0dd71edf17031406e1d
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5639
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 321ab2f58f62bf3037ee32e1696bacd14c8f06ed)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211020
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-16 11:36:37 +02:00
Caolán McNamara 6451dfad11 html import: take an unsized image's size from the link update
Don't open the image file during parsing to read its header. The image is
registered as a link, so the frame can start at the HTML default size and get
the real size when the links are updated.

Change-Id: I47b160b883f3bc6bd6de23ac3085df1ef83fcdc3
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10845
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 69bd0e4d6dbcc67f8dd9b63e15356890445081f7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211017
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-16 11:08:08 +02:00
Caolán McNamara 7558a892f6 pdf import: skip only one end of line after the stream keyword
every following newline was skipped, so stream data starting with
0x0a or 0x0d lost a byte and an encrypted stream decrypted to the
wrong bytes

CppunitTest_vcl_pdf_encryption failed at random in CI with:

 PDFEncryptionTest.cxx:362:Assertion
 Test name: (anonymous namespace)::testEmbeddedDocumentOfEncryptedHybridFile::TestBody
 equality assertion failed
 - Expected: 0
 - Actual  : -38

 Failures !!!
 Run: 16   Failure total: 1   Failures: 1   Errors: 0

since:

commit b6f98b7115
Date:   Wed Oct 26 17:55:02 2016 +0200

    xmlsecurity PDF verify: support SHA-256

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I72e4e72506942ed0151e5d96a1abc94cce1a059f
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/11825
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit b42ffcd8af9427a0ecdfe917d897db98d4f00b6f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210954
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-14 20:20:56 +02:00
Caolán McNamara 1e047c45bc docx export: write each bound value only into its own customXml item
every custom xml item was given the values of every data-bound control,
so a document with two data stores came back with both controls showing
the same value, and testTdf147724 failed in ci with:

 xmltesttools.cxx:214:Assertion
 Test name: testTdf147724::Load_Verify_Reload_Verify
 equality assertion failed
 - Expected: Placeholder -> *ABC*
 - Actual  : Placeholder -> *HERUNTERLADEN*
 - In <>, XPath contents of child does not match

the second control's data binding names no store, so the import picks a
store by std::unordered_map iteration order. That order differs from one
builder to the next, and the test accepts either value for that control,
so only some machines saw the failure.

since:

commit b5c616d10b
Date:   Wed Nov 24 14:50:12 2021 +0300

    tdf#104823: support for sdt plain text fields

so keep the storeItemID of the data binding along with the value and
only update the item whose ds:itemID matches it

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I794ebb7c647ecddcd2cee3e90c25145ba4c32b97
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12083
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit b522379deae4c9df243d0493a3d242e80822c171)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210923
Tested-by: Jenkins
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-14 12:56:58 +02:00
Caolán McNamara d5d950c2b9 xslt filter: set every libxslt transformation option explicitly
libxslt leaves each option unset on a fresh transformation context and takes
its own default for it.

The service registers no libxml input handlers, and a stylesheet only has to
produce the result tree, so set all of them and allow back local file reads
alone, which is how a stylesheet picks up a second file beside the one it
converts.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I58abfc3919e26683d3fe2de72362f6c453eef8cf
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9939
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 02da3650b1bb71170112a480c7fa0220a2a34490)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210434
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-14 12:56:48 +02:00
Caolán McNamara f8ed170f27 help: give every libxslt preference a value, not just one of them
A preference left unset keeps whatever libxslt defaults to, so name each
one instead of only XSLT_SECPREF_READ_FILE.

Reads over the network are allowed as well now, as a help page pulls in
another page through a vnd.sun.star.help URL and libxslt counts any
scheme other than file as a network read.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I1ad16fe7244505ae6122a1a272597464612f099d
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9935
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit d8923fe423af48cb02a60b01ec881aa12f6c14ca)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210432
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-14 12:56:39 +02:00
Caolán McNamara 5033a915c3 docx export: set custom xml values through XPathAPI instead of XSLT
each data binding built its own stylesheet and its own transformation
pass over the item, because different bindings can use conflicting
namespace prefixes

The import side already resolves the same binding with XPathAPI and
RegisterDataBindingNamespaces, so select the nodes that way here too
and set their text on a copy of the custom xml.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I4b64bc56fd8a1c6c6641cf3ea9a44f7fed20206f
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9941
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit fe2f99ef74ef02e803aaf01dcc2b7f6e1cea67f7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210430
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-14 12:56:31 +02:00
Caolán McNamara c3ec833e11 move the data binding namespace registration to a shared header
the docx export needs to register the same prefixes before it can
evaluate an xpath from the data binding

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I237deada64564a91b312c5b4670851d4ba57cd03
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9940
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit b482d8a3f019ae725f8242cbd7f1e258ab2b6cbd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210441
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-14 12:56:21 +02:00
Caolán McNamara e65a82d91b ofz#550481740 not a valid value for type EmfPlusHatchStyle
drawinglayer/source/tools/emfphelperdata.cxx:771:32: runtime error: load of value 4280295456, which is not a valid value for type 'EmfPlusHatchStyle'
     #0 0x7b14dd7d4d02 in emfplushelper::EmfPlusHelperData::EMFPPlusFillPolygon(basegfx::B2DPolyPolygon const&, bool, unsigned int) drawinglayer/source/tools/emfphelperdata.cxx:771:32
     #1 0x7b14dd7f903a in emfplushelper::EmfPlusHelperData::processEmfPlusData(SvMemoryStream&, drawinglayer::geometry::ViewInformation2D const&) drawinglayer/source/tools/emfphelperdata.cxx:1776:29
     #2 0x7b14dd7c020c in emfplushelper::EmfPlusHelper::processEmfPlusData(SvMemoryStream&, drawinglayer::geometry::ViewInformation2D const&) drawinglayer/source/tools/emfplushelper.cxx:41:14
     #3 0x7b14dd932d9d in wmfemfhelper::implInterpretMetafile(GDIMetaFile const&, wmfemfhelper::TargetHolders&, wmfemfhelper::PropertyHolders&, drawinglayer::geometry::ViewInformation2D const&) drawinglayer/source/tools/wmfemfhelper.cxx:2957:43
     #4 0x7b14dd919d51 in wmfemfhelper::interpretMetafile(GDIMetaFile const&, drawinglayer::geometry::ViewInformation2D const&) drawinglayer/source/tools/wmfemfhelper.cxx:2993:9
     #5 0x7b14dd470d93 in drawinglayer::primitive2d::MetafilePrimitive2D::create2DDecomposition(drawinglayer::geometry::ViewInformation2D const&) const drawinglayer/source/primitive2d/metafileprimitive2d.cxx:42:42
     #6 0x7f14fb527e4f in drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx:90:41
     #7 0x7b14dd4727d5 in TestImportWMF drawinglayer/source/primitive2d/metafileprimitive2d.cxx:149:16

so keep the hatch style as the value read from the stream, and an
unknown one then reaches the switch default

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I9725f2f80d3a00fbf82ac5a84cf55b5c071af68b
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/11529
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 906c713f2cdd05372db04c1d807d31b1fff5377a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210589
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-09 15:55:23 +02:00
Caolán McNamara 5134879789 crashtesting: don't read a frame that JoinFrame destroyed
reproduce by loading crashtesting (rtf) file:
swxtextframe_createtextcursorbyrange.sample
and exporting it to pdf:

 #0 SwContentNode::GetSwAttrSet (this=0x0) at sw/inc/node.hxx:750
 #1 SwTextFrame::RecalcAllLines at sw/source/core/text/txtfrm.cxx:4130
 #2 SwLayAction::FormatContent at sw/source/core/layout/layact.cxx:1870
 #3 SwLayAction::InternalAction at sw/source/core/layout/layact.cxx:640
 #4 SwLayAction::Action at sw/source/core/layout/layact.cxx:418
 #5 SwViewShell::CalcLayout at sw/source/core/view/viewsh.cxx:990

the frame at #2 has m_pMergedPara 0, GetDep() 0 and mbInDtor true, so
it was freed under the object formatting two statements earlier:

 SwFrame::DestroyFrame            (the follow)
 SwTextFrame::JoinFrame                       frmform.cxx:778
 SwTextFrame::AdjustFollow_                   frmform.cxx:681
 SwTextFrame::FormatAdjust / Format_ / Format
 SwContentFrame::MakeAll                      calcmove.cxx:1633
 SwFrame::Calc                    (the MASTER)
 SwAnchoredDrawObject::MakeObjPosAnchoredAtPara
 SwObjectFormatter::FormatObj_
 SwObjectFormatterTextFrame::DoFormatObj
 SwObjectFormatter::FormatObjsAtFrame_

FormatContent is formatting a follow frame. Placing a drawing object
anchored in that paragraph calls Calc on the master, the master reflows
and takes back its text, and JoinFrame then destroys the follow.

the loop already keeps an SfxDeleteListener on pContentPrev, so keep one
on pContent too and return false, and the caller invalidates the page and
runs it again.

no unit test, the layout tests only have the bundled fonts and this
document asks for Palatino Linotype. Only P052, its metric substitute,
keeps the layout that splits the paragraph, and P052 isn't bundled
either, so the document needs adjusting first.

reached since:

commit ac332d53d565325f3db2697126d97e02a15e4b5d
Date:   Wed Aug 26 21:02:06 2026 +0000

    crashtesting: pass the collected page number to CheckMovedFwdCondition

which dropped the DoFormatObj assert that used to stop this document
before the object formatting could complete the join.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I64e95ba6d3a6fda6ab585b5f319be2fb8bca8533
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/11273
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit ab7337476075e0b903ec5cb705821d8b3a14e9f7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210590
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-09 15:18:26 +02:00
Caolán McNamara 890f388a78 move isScriptURLAllowed onto SfxObjectShell
it was private to sfx2's eventsupplier.hxx, so nothing outside sfx2
could run the AllowedDocumentEventURLs test

Change-Id: I814a965cafc245eb7b7f2d8fb18a81d1f7b7e50f
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10920
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 4a5b2dd74b4e82b183961ca8f50d80bd485d5359)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210591
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-09 12:59:48 +02:00
Caolán McNamara 6b783a7cc7 ofz#557289178 the top text append might not be a SwXText
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iae36ce22ac78d7d69dba9d70285cc07affcb03ae
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/11522
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit aeda82ce2db65f0ed6f59fc4826eab8653ef4a6d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210541
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-08 16:17:04 +02:00
Caolán McNamara 6c859d0acd crashtesting: don't thread a formula that uses ocSpill
see on loading forums/xlsx/forum-mso-en4-748529.xlsx and doing a
hard recalculation, which aborts with:

 soffice.bin: sc/inc/formulacell.hxx:514: void ScFormulaCell::MaybeInterpret():
 Assertion `!rDocument.IsThreadedGroupCalcInProgress()' failed.

 #4  ScFormulaCell::MaybeInterpret at sc/inc/formulacell.hxx:514
 #5  ScFormulaCell::IsEmpty at sc/source/core/data/formulacell.cxx:3153
 #6  FillMatrixHandler::operator() at sc/source/core/data/column2.cxx:2636
 #7  sc::ParseBlock at sc/inc/mtvfunctions.hxx:66
 #8  ScColumn::FillMatrix at sc/source/core/data/column2.cxx:2708
 #9  ScTable::FillMatrix at sc/source/core/data/table1.cxx:2700
 #10 ScDocument::FillMatrix at sc/source/core/data/documen8.cxx:400
 #11 ScInterpreter::CreateMatrixFromDoubleRef at sc/source/core/tool/interpr5.cxx:386
 #12 ScInterpreter::ScSpilledRange at sc/source/core/tool/interpr1.cxx:1703
 #13 ScInterpreter::DispatchOpCode at sc/source/core/tool/interpr4.cxx:3868
 #14 ScInterpreter::Interpret at sc/source/core/tool/interpr4.cxx:4414
 #15 ScFormulaCell::InterpretTail at sc/source/core/data/formulacell.cxx:2209
 #16 ScColumn::CalculateInThread at sc/source/core/data/column2.cxx:3270
 #17 ScTable::CalculateInColumnInThread at sc/source/core/data/table1.cxx:2740
 #18 ScDocument::CalculateInColumnInThread at sc/source/core/data/documen8.cxx:421
 #19 Executor::doWork at sc/source/core/data/formulacell.cxx:5463

ScSpilledRange calculates cells itself. It calls MaybeInterpret on the
master cell of the dynamic array, and CreateMatrixFromDoubleRef then
covers the whole spill range, so FillMatrix asks every cell in that
range whether it is empty and IsEmpty calculates it. A worker thread
inside a threaded group calculation must not calculate a cell.

The dependency evaluator can't cover it either, only the operand's own
cell is named by a reference token and how far the spill reaches is
known only once that cell has been calculated

an issue since:

commit 9b97b0fc91bce4b8726ea210347e8ea84270e148
Date:   Mon Jul 6 13:09:39 2026 +0000

    sc: add the # postfix operator for spilled-range references

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Id58e88d1bd927576e4723dd23bc119673feed108
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/11285
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit 89af05e8a5e8ce4ae337e2f0048f670940573930)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210542
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-08 16:16:39 +02:00
Caolán McNamara fe9db2c8e1 ofz#557542656 negation of -2147483648 cannot be represented
drawinglayer/source/tools/emfphelperdata.cxx:451:83: runtime error: negation of -2147483648 cannot be represented in type 'sal_Int32' (aka 'int'); cast to an unsigned type to negate this value to itself
     #0 0x7b71c0dc8ec7 in emfplushelper::EmfPlusHelperData::mappingChanged() drawinglayer/source/tools/emfphelperdata.cxx:451:83
     #1 0x7b71c0de6a2d in emfplushelper::EmfPlusHelperData::EmfPlusHelperData(SvMemoryStream&, wmfemfhelper::TargetHolders&, wmfemfhelper::PropertyHolders&) drawinglayer/source/tools/emfphelperdata.cxx:1503:9
     #2 0x7b71c0dc0059 in emfplushelper::EmfPlusHelper::EmfPlusHelper(SvMemoryStream&, wmfemfhelper::TargetHolders&, wmfemfhelper::PropertyHolders&) drawinglayer/source/tools/emfplushelper.cxx:29:17
     #3 0x7b71c0f31dc6 in wmfemfhelper::implInterpretMetafile(GDIMetaFile const&, wmfemfhelper::TargetHolders&, wmfemfhelper::PropertyHolders&, drawinglayer::geometry::ViewInformation2D const&) drawinglayer/source/tools/wmfemfhelper.cxx:2923:37
     #4 0x7b71c0f19d51 in wmfemfhelper::interpretMetafile(GDIMetaFile const&, drawinglayer::geometry::ViewInformation2D const&) drawinglayer/source/tools/wmfemfhelper.cxx:2993:9
     #5 0x7b71c0a70d93 in drawinglayer::primitive2d::MetafilePrimitive2D::create2DDecomposition(drawinglayer::geometry::ViewInformation2D const&) const drawinglayer/source/primitive2d/metafileprimitive2d.cxx:42:42
     #6 0x7f71deb27e4f in drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx:90:41
     #7 0x7b71c0a727d5 in TestImportWMF drawinglayer/source/primitive2d/metafileprimitive2d.cxx:149:16

so negate the frame offsets as doubles

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I2cf478245f30f4573bfa5ccb2c6dcbe5c603e38b
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/11528
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit f6f1f208a87c2a725e5c20c6a7453fa5679eca76)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210540
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-08 16:16:21 +02:00
Caolán McNamara 5c7c41ef9e valgrind: ZCodec::InitDecompress uninitialised values on a short gzip header
Conditional jump or move depends on uninitialised value(s)
   at ZCodec::InitDecompress(SvStream&) (zcodec.cxx:353)
   by ZCodec::AttemptDecompression(SvStream&, SvStream&) (zcodec.cxx:384)
   by PlainTextFilterDetect::detect(...) (filterdetect.cxx:184)
   by filter::config::TypeDetection::impl_askDetectService(...) (typedetection.cxx:1139)
   by filter::config::TypeDetection::impl_detectTypeFlatAndDeep(...) (typedetection.cxx:1044)
   by filter::config::TypeDetection::queryTypeByDescriptor(...) (typedetection.cxx:439)
   by framework::LoadEnv::impl_detectTypeAndFilter() (loadenv.cxx:771)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I952005ee74189a46d5faf39c8e7fef3ffda2082b
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9153
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit a2cf813f1298301d2b95a58e77fe21714beafa32)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209314
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-05 12:46:12 +02:00
Caolán McNamara 4e55dfcf6d crashtesting: keep the spell-check repaint range within the paragraph text
reproduce by loading ooo59043-1.odt and exporting it to the binary doc
format, which toggles the tracked-change display.

that save-time show and hide joins and splits the text nodes, and can
leave the spell wrong list with an invalid end past the now shorter
text.

the idle autospell then maps that end and asserts, here with nIndex 15
on a 12 char node:

    soffice.bin: sw/source/core/text/txtfrm.cxx:1344:
    Assertion `nIndex <= pNode->Len()' failed.

    #4  sw::MapModelToView (nIndex=15) at txtfrm.cxx:1344
    #5  SwTextFrame::MapModelToView (nIndex=15) at txtfrm.cxx:1385
    #6  lcl_CalculateRepaintRect (nChgStart=0, nChgEnd=15) at txtedt.cxx
    #7  SwTextFrame::AutoSpell_ at txtedt.cxx:1519
    #8  SwLayIdle::DoIdleJob_ (ONLINE_SPELLING) at layact.cxx:2171
    #9  SwLayIdle::DoIdleJob at layact.cxx:2312
    #10 SwLayIdle::SwLayIdle at layact.cxx:2573
    #11 SwViewShell::LayoutIdle at viewsh.cxx:927
    #12 sw::DocumentTimerManager::DoIdleJobs at DocumentTimerManager.cxx:179

AutoSpell_ already tolerates the over-long end, set with std::max
against the text length a few lines up, and the word scanner stops at
the real end.

so clamp the repaint range the same way before it is mapped.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5ad086753f8b3fc0f838a45a7291cd62a4d4a343
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/6699
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 1920f81f2df779c9787256c9ad93903640817419)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210508
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-05 12:46:06 +02:00
Caolán McNamara 4f8e7af1d8 crashtesting: odf export assert deleting the last node of a hidden merge
There are two rules for which node of a merged paragraph provides the
paragraph properties. The classic rule takes the first node that has
visible text.

Under the classic rule, when SwContentNode::DelFrames deletes the
properties node and it is also the last node, no node has visible text
left, so the merge must be empty. An assert checks that, and it always
held until:

commit 0849ddd0b1
Date:   Wed Oct 8 19:29:46 2025 +0200

    sw: text formatting: implement per-line paragraph properties like Word

which added the second rule: with a hidden paragraph mark the
properties node is the last node, even while earlier nodes still have
visible text. Now the same delete can happen while the merge still has
visible text, and the assert fires falsely.

So allow non-empty extents in hidden paragraph mode too. The existing
relocation loop already picks the correct new properties node under
both rules.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I599b0c09c92e5f9adaa1874a6de5a054eb947d8b
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9281
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 29b5b72c31483af4585fe419ce1789b990c55c8e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210477
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-04 13:56:11 +02:00
Caolán McNamara b77bd9a0c8 pdf import: check the sizes before building the png scan lines
dismiss unreasonable sizes and ImageStream::getLine returns null when it
could not allocate its line buffer.

Change-Id: I193038c0ff8e2f0ed68235569fc72ff7028db2c2
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/10751
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit a463e295ab095ece7939997482f6d38cb8ca6a5a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210415
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-02 16:11:45 +02:00
Caolán McNamara 8e4ea60983 crashtesting: let ZSortFly hold its own copy of the anchor
possibly an issue since:

commit 1d3d2a9952
Date:   Mon Jun 20 17:27:53 2022 +0200

    tdf#148687 tdf#149173 tdf#149546 sw: fix crash with textboxes

reproduce by loading tdf135164-3.docx and exporting it to odt, which
under asan gives:

 ==582547==ERROR: AddressSanitizer: heap-use-after-free on address 0x7c2d9893bae0 at pc 0x7b6d5656a263 bp 0x7b6d67ee9b90 sp 0x7b6d67ee9b88
 READ of size 1 at 0x7c2d9893bae0 thread T76
     #0 0x7b6d5656a262 in std::_Optional_base<SwPosition, false, false>::_Optional_base(std::_Optional_base<SwPosition, false, false> const&) c++/15/optional:513:39
     #1 0x7b6d5653ab8a in std::optional<SwPosition>::optional(std::optional<SwPosition> const&) c++/15/optional:778:11
     #2 0x7b6d56511a07 in SwFormatAnchor::SwFormatAnchor(SwFormatAnchor const&) sw/source/core/layout/atrfrm.cxx:1694:7
     #3 0x7b6d553c8de8 in sw::DocumentContentOperationsManager::CopyFlyInFlyImpl(SwNodeRange const&, SwPaM const*, SwNode&, bool, SwCopyFlags, bool) const sw/source/core/doc/DocumentContentOperationsManager.cxx:4121:24
     #4 0x7b6d553c53c0 in sw::DocumentContentOperationsManager::CopyWithFlyInFly(SwNodeRange const&, SwNode&, std::pair<SwPaM const&, SwPosition const&> const*, bool, bool, bool, SwCopyFlags) const sw/source/core/doc/DocumentContentOperationsManager.cxx:3932:9
     #5 0x7b6d553d81ee in sw::DocumentContentOperationsManager::CopyImplImpl(SwPaM&, SwPosition&, SwCopyFlags, SwPaM*) const sw/source/core/doc/DocumentContentOperationsManager.cxx:5470:17
     #6 0x7b6d55375290 in sw::DocumentContentOperationsManager::CopyImpl(SwPaM&, SwPosition&, SwCopyFlags, SwPaM*) const sw/source/core/doc/DocumentContentOperationsManager.cxx:5087:16
     #7 0x7b6d55373681 in sw::DocumentContentOperationsManager::CopyRange(SwPaM&, SwPosition&, SwCopyFlags, unsigned int) const sw/source/core/doc/DocumentContentOperationsManager.cxx:2113:16
     #8 0x7b6d550f2385 in SwRangeRedline::CopyToSection() sw/source/core/doc/docredln.cxx:2105:46
     #9 0x7b6d550eb84b in SwRangeRedline::Hide(unsigned short, unsigned long, bool) sw/source/core/doc/docredln.cxx:1815:17
     #10 0x7b6d5550a3e2 in sw::DocumentRedlineManager::SetRedlineFlags(RedlineFlags, SfxRedlineRecordingMode, bool) sw/source/core/doc/DocumentRedlineManager.cxx:1348:17
     #11 0x7b6d58f79b33 in SwXMLWriter::Write_(SfxItemSet const*) sw/source/filter/xml/wrtxml.cxx:243:41
     #12 0x7b6d58f7f80b in SwXMLWriter::WriteMedium(SfxMedium&) sw/source/filter/xml/wrtxml.cxx:467:12
     #13 0x7b6d58eb86fa in StgWriter::Write(SwPaM&, com::sun::star::uno::Reference<com::sun::star::embed::XStorage> const&, rtl::OUString const*, SfxMedium*) sw/source/filter/writer/writer.cxx:506:33
     #14 0x7b6d58f7fb46 in SwXMLWriter::Write(SwPaM&, SfxMedium&, rtl::OUString const*) sw/source/filter/xml/wrtxml.cxx:474:47
     #15 0x7b6d58751d1e in SwWriter::Write(tools::SvRef<Writer> const&, rtl::OUString const*) sw/source/filter/basflt/shellio.cxx:995:28
     #16 0x7b6d5922e93a in SwDocShell::SaveAs(SfxMedium&) sw/source/uibase/app/docsh.cxx:545:21
     #17 0x7f6dd5c75ac9 in SfxObjectShell::SaveAsOwnFormat(SfxMedium&) sfx2/source/doc/objstor.cxx:3513:16
     #18 0x7f6dd5c4d8cb in SfxObjectShell::SaveTo_Impl(SfxMedium&, SfxItemSet const*) sfx2/source/doc/objstor.cxx:1748:23
     #19 0x7f6dd5c72df9 in SfxObjectShell::PreDoSaveAs_Impl(rtl::OUString const&, rtl::OUString const&, SfxItemSet const&, cpo::uno::Sequence<com::sun::star::beans::PropertyValue> const&) sfx2/source/doc/objstor.cxx:3263:39
     #20 0x7f6dd5c6e279 in SfxObjectShell::CommonSaveAs_Impl(INetURLObject const&, rtl::OUString const&, SfxItemSet&, cpo::uno::Sequence<com::sun::star::beans::PropertyValue> const&) sfx2/source/doc/objstor.cxx:3051:20
     #21 0x7f6dd5bebeab in SfxObjectShell::APISaveAs_Impl(std::basic_string_view<char16_t, std::char_traits<char16_t>>, SfxItemSet&, cpo::uno::Sequence<com::sun::star::beans::PropertyValue> const&) sfx2/source/doc/objserv.cxx:329:19
     #22 0x7f6dd5dfed92 in SfxBaseModel::impl_store(rtl::OUString const&, cpo::uno::Sequence<com::sun::star::beans::PropertyValue> const&, bool) sfx2/source/doc/sfxbasemodel.cxx:3247:42
     #23 0x7f6dd5e02fa8 in SfxBaseModel::storeToURL(rtl::OUString const&, cpo::uno::Sequence<com::sun::star::beans::PropertyValue> const&) sfx2/source/doc/sfxbasemodel.cxx:1830:13
 0x7c2d9893bae0 is located 96 bytes inside of 120-byte region [0x7c2d9893ba80,0x7c2d9893baf8)
 freed by thread T76 here:
     #0 0x561412fdfb36 in operator delete(void*, unsigned long) (instdir/program/soffice.bin+0x15cb36) (BuildId: 92501b697c39a7d873a4e4e34cbe433111a30f3c)
     #1 0x7b6d56511ce6 in SwFormatAnchor::~SwFormatAnchor() sw/source/core/layout/atrfrm.cxx:1704:1
     #2 0x7f6dd0447dcf in implCleanupItemEntry(SfxPoolItem const*) svl/source/items/globalpool.cxx:459:5
     #3 0x7f6dd068f87a in SfxItemSet::PutImpl(SfxPoolItem const&, bool) svl/source/items/itemset.cxx:646:5
     #4 0x7b6d5400e842 in SfxItemSet::Put(SfxPoolItem const&) include/svl/itemset.hxx:230:18
     #5 0x7b6d5432d284 in SwAttrSet::Put_BC(SfxPoolItem const&, SwAttrSet*, SwAttrSet*) sw/source/core/attr/swatrset.cxx:232:40
     #6 0x7b6d543079d1 in SwFormat::SetFormatAttr(SfxPoolItem const&) sw/source/core/attr/format.cxx:531:23
     #7 0x7b6d55a2716e in SwTextBoxHelper::changeAnchor(SwFrameFormat*, SdrObject*) sw/source/core/doc/textboxhelper.cxx:1332:34
     #8 0x7b6d55a462a9 in SwTextBoxNode::Clone(SwDoc*, SwFormatAnchor const&, SwFrameFormat*, bool, bool) const sw/source/core/doc/textboxhelper.cxx:2002:9
     #9 0x7b6d55634d51 in sw::DocumentLayoutManager::CopyLayoutFormat(SwFrameFormat const&, SwFormatAnchor const&, bool, bool) sw/source/core/doc/DocumentLayoutManager.cxx:478:21
     #10 0x7b6d553ca892 in sw::DocumentContentOperationsManager::CopyFlyInFlyImpl(SwNodeRange const&, SwPaM const*, SwNode&, bool, SwCopyFlags, bool) const sw/source/core/doc/DocumentContentOperationsManager.cxx:4232:71
     #11 0x7b6d553c53c0 in sw::DocumentContentOperationsManager::CopyWithFlyInFly(SwNodeRange const&, SwNode&, std::pair<SwPaM const&, SwPosition const&> const*, bool, bool, bool, SwCopyFlags) const sw/source/core/doc/DocumentContentOperationsManager.cxx:3932:9
     #12 0x7b6d553d81ee in sw::DocumentContentOperationsManager::CopyImplImpl(SwPaM&, SwPosition&, SwCopyFlags, SwPaM*) const sw/source/core/doc/DocumentContentOperationsManager.cxx:5470:17
     #13 0x7b6d55375290 in sw::DocumentContentOperationsManager::CopyImpl(SwPaM&, SwPosition&, SwCopyFlags, SwPaM*) const sw/source/core/doc/DocumentContentOperationsManager.cxx:5087:16
     #14 0x7b6d55373681 in sw::DocumentContentOperationsManager::CopyRange(SwPaM&, SwPosition&, SwCopyFlags, unsigned int) const sw/source/core/doc/DocumentContentOperationsManager.cxx:2113:16
     #15 0x7b6d550f2385 in SwRangeRedline::CopyToSection() sw/source/core/doc/docredln.cxx:2105:46
     #16 0x7b6d550eb84b in SwRangeRedline::Hide(unsigned short, unsigned long, bool) sw/source/core/doc/docredln.cxx:1815:17
     #17 0x7b6d5550a3e2 in sw::DocumentRedlineManager::SetRedlineFlags(RedlineFlags, SfxRedlineRecordingMode, bool) sw/source/core/doc/DocumentRedlineManager.cxx:1348:17
     #18 0x7b6d58f79b33 in SwXMLWriter::Write_(SfxItemSet const*) sw/source/filter/xml/wrtxml.cxx:243:41

It pointed at the anchor item owned by the format, and the fly copy
loop can set a new anchor on that format while the sorted set is
still being walked

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I3150efbd39c3da1241fdc7eb5036d2fabd38e37f
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10580
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 174958393287389a921b9d3c11664670882998c3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210336
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-01 19:52:38 +02:00
Caolán McNamara dd8bc7fd52 skip the python KillPython step so two windows builds don't race over it
KillPython runs an inline CodeTaskFactory task that compiles a temporary
dll and loads it. Two parallel builds on one machine race over that dll,
and one build fails to find it:

  pyproject.props(176,5): error MSB4175: The task factory "CodeTaskFactory"
  could not be loaded from the assembly "...\Microsoft.Build.Tasks.Core.dll".
  Could not find file '...\tmp\rmlsuizu\rmlsuizu.dll'.

KillPython only kills a stray python.exe that holds the output file open
across an incremental rebuild. A clean build has none to kill, so pass
/p:KillPython=false to override pythoncore.vcxproj and skip the target.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ic6cc3d51d4409bce6cc95137626debcab67dbc53
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10183
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit a287185f62eaa49f03ab0b3b2e5d956221ef9997)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210291
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-01 10:44:39 +02:00
Caolán McNamara 8568a3191d cid#562978 silence Out-of-bounds access
coverity only takes the tag when it sits on the line directly above the
statement, and the rest of the tree spells out the FALSE classification

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I2cb97c3314a7b612b8fe5bbe2270c7436d1d0717
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10507
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 260f71263c7a37290d50a182ab1e8616a4b99de3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210288
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-31 20:25:20 +02:00
Caolán McNamara cf45ff8f40 cid#563264 Unchecked return value
cwd is left empty when the conversion fails, and searching an empty
path is not a no-op, it looks for the file under / instead

so only search when we got a path back

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I915103cfd446ff87f0116d832b48e4432c0be862
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10099
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit e2552aaae8b103940e16b03cbb15a277afe74c0e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210287
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-31 17:33:11 +02:00
Caolán McNamara 7bced8b002 crashtesting: pass the collected page number to CheckMovedFwdCondition
reproduce by loading bugtrackers/docx/novell592907-1.docx under the
crashtest reduced font set:

 soffice.bin: sw/source/core/layout/objectformattertxtfrm.cxx:235: virtual bool SwObjectFormatterTextFrame::DoFormatObj(SwAnchoredObject&, bool): Assertion `GetPageFrame().GetPhyPageNum() == GetPgNumOfCollected(nIdx)' failed.
 #12 SwObjectFormatterTextFrame::DoFormatObj(SwAnchoredObject&, bool) at ./sw/source/core/layout/objectformattertxtfrm.cxx:238
 #13 SwObjectFormatter::FormatObj(SwAnchoredObject&, SwFrame*, SwPageFrame const*, SwLayAction*) at ./sw/source/core/layout/objectformatter.cxx:191 (discriminator 3)
 #14 CalcContent(SwLayoutFrame*, bool) at ./sw/source/core/layout/fly.cxx:1880 (discriminator 4)

a cluster of 27 crashtesting documents assert like this

partial revert of:

commit 533a998e54
Date:   Thu May 6 18:20:14 2021 +0200

    tdf#138518 sw: layout: fix assert on ooo43913-1.doc

The two page numbers only have to match for the FormatObjsAtFrame_
caller. On the CalcContent route the formatter is built with the anchor
text frame's page, while Collect recorded the page of the frame holding
the anchor character. Here the anchor paragraph is split over two
pages: the anchor character sits in the follow on page 2 while
CalcContent formats the master on page 1. Nothing has moved.

In a release build the anchor is then measured from the formatter's
page and looks moved forward, so the master paragraph gets marked to
move to the next page for an anchor that never moved.

The other user of the page frame parameter, the scan over the page's
flys, was removed in:

commit 59a917305d
Date:   Wed Dec 10 21:13:55 2025 +0500

    tdf#169882: revert commit c799de145f

leaving GetPhyPageNum as its only use, so pass the snapshot page number
collected earlier and drop the asserts. Whether an anchor moved forward
is again decided against the page numbering recorded at collect time,
as it was before 533a998e54.

A debug build without this change aborts reliably on loading the added
test document. Its final layout is the same with and without the
change, so the test asserts only the page count.

The tdf#138518 bugdoc ooo43913-1.doc still passes in crashtesting with
this change

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I248072d9e7101f1f925d6d75e3cb7a9dec855313
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10147
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit ac332d53d565325f3db2697126d97e02a15e4b5d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210289
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-31 16:52:11 +02:00
Caolán McNamara dec0217dd3 sw: fold the filter copies of allowAccessLink into SwDoc::AllowAccessLink
the html and markdown filters each had their own copy of the same referer
lookup that SwDoc::GetLinkReferer already does

the html object import now makes the same check the graphic import makes
on the url it reads from

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I25f4c978a2c3c3680c7eca80970534a72fde1369
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10226
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit ef4a0f39342e6dfb1e2c8f2b13e7b40954e843f8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210290
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-31 15:56:36 +02:00
Caolán McNamara 5e3fe53bdb cid#562881 Double unlock
the double-unlock finding is a bit bogus, but there is a real oddity
here worth fixing.

since:

commit 6c9909dee4
Date:   Fri Oct 22 14:11:39 2021 +0200

    fix std::unique_lock unlocking

84a54f6c38 moved the end() test inside
the guard, but left the dereference outside it

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ia439ebffc9179e74d926efc7c3ea7dec2fc1f7db
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9964
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 791c9f631b0ce352d356f5486ba537c9a4d3f8fc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210134
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-27 21:14:20 +02:00
Caolán McNamara ecd9ee7aa1 pass a referer through setSvxBrushItemAsFillAttributesToTargetSet
SvxBrushItem::GetGraphic wants the name of the document the brush came
from, so take it as an argument and hand in SwDoc::GetLinkReferer
wherever a document is at hand, the Writer style, frame and background
shell paths included.

The dialog and example-window callers pass the name of the active
document shell through a new svx helper getActiveDocumentLinkReferer.

The hand-rolled copies of the GetPersist, HasName, GetMedium GetName
sequence elsewhere in sw now call SwDoc::GetLinkReferer too.

Change-Id: I8693d27869baed79962b2d5bdcb7b7e2c63227bb
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8200
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 18f91ac71710027479dfe9f206ae2207bad8f2b7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209827
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-25 11:16:39 +02:00
Caolán McNamara 8749466df2 sc: convert remaining raw ScPatternAttr* class members to CellAttributeHolder
We have added various workarounds for ScPatternAttr use after free
issues since:

  commit 2e1f9da8a6
  Date:   Sat Dec 23 15:52:06 2023 +0100
      Decouple ScPatternAttr from SfxItemPool

separated ScPatternAttr from SfxItemPool.

Prior to that an ScPatternAttr was an SfxPoolItem held in the doc's
SfxItemPool which kept every item alive for the document's whole
lifetime, so any raw const ScPatternAttr* was basically safe.

The various workarounds for the new behaviour were:

  commit dca19993a4c732e95b9a47e1abdcaad6efbeebe9
  Date:   Sat Jan 6 14:40:28 2024 +0100
      tdf#159042: crash after changing cell style (if direct formatting done)

  commit 19437715eb415fe2c40b8b40dbe04ddca28f9a35
  Date:   Thu Sep 12 12:06:28 2024 +0100
      null pattern deref seen in ScViewData::SetEditEngine

  commit e384f2e8de9603ee65a3edc6dcb50b07116ee4fc
  Date:   Mon Mar 10 14:45:22 2025 +0000
      crashtesting: crash on reimport of xlsx output of forum-pl-2758.ods

  commit 7999585bd8378f1a8d04ea2a9a93a8e0bf4d8eb6
  Date:   Fri May 9 08:50:17 2025 +0100
      crash on null pattern de-ref

  commit 1bf9bbea96
  Date:   Tue Oct 28 16:53:49 2025 +0300
      tdf#169115: sc: fix use-after-free bug in ScDocument::FillInfo

  commit 9f366af81478ad218dc2ef2e37423a9ebcc84e73
  Date:   Sat Apr 25 14:47:02 2026 +0200
      ScPatternAttr use-after-free

  commit 20fe691a18fb35120d0765dd1519acd6d2986c38
  Date:   Tue Apr 28 08:33:34 2026 +0200
      ScPatternAttr use-after-free (2)

This commit picks the class member fields that are still raw
ScPatternAttr* and converts them to CellAttributeHolder:

  ScUsedAreaIterator::pPattern and pFoundPattern
  ScInputHandler::pLastPattern
  LotAttrCol::ENTRY::pPattAttr
  ScPatternCache::Entry::pPattern

The CalcAll() workaround from 9f366af81478 then doesn't seem to be needed(?)

A new compiler plugin catches class member fields of raw type
ScPatternAttr pointer.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ibb9f28b8fcaa5470c7a82eee52900c2d60434e41
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3163
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 9c7b6313a29067bf0eef12884fc3ce7efb0374e5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209822
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-25 08:52:44 +02:00
Caolán McNamara dfc2a54bce ofz: fix harfbuzz msan build
since:

commit 6a3e455381
Date:   Sat Aug 1 02:25:22 2026 +0300

    harfbuzz: pass -fvisibility=hidden as a meson option

==3201==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x555d9cd44009 in operator() /src/libreoffice/vcl/source/gdi/CommonSalLayout.cxx:663:38
    #1 0x555d9cd44009 in GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs&, SalLayoutGlyphsImpl const*) vcl/source/gdi/CommonSalLayout.cxx:684:25
    #2 0x555d9c96a880 in OutputDevice::ImplLayout(rtl::OUString const&, int, int, Point const&, long, std::__1::span<double const, 18446744073709551615ul>, std::__1::span<unsigned char const, 18446744073709551615ul>, SalLayoutFlags, vcl::text::TextLayoutCache const*, SalLayoutGlyphs const*, std::__1::optional<int>, std::__1::optional<int>, std::__1::optional<int>) const vcl/source/outdev/text.cxx:1269:36

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I43dd3901f78b33b85e9f8e224f287a145f4510fa
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9753
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 8184a699b28e83f8209f73f66e0c7c2a43f2b2d9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209830
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-25 08:52:25 +02:00
Caolán McNamara 3329b7d5cf extend exotic protocol list
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I3d198119f6076278041d27f9f8b8fa62607d37ff
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9652
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit aff5d73c5433f79228a3a79d26a501ba46ffbfbb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209524
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-23 13:26:26 +02:00
Caolán McNamara 63ebf5c928 sc: search the name list forwards again in XclImpNameManager::FindName
revert:

commit ea093514e4
Date:   Sun Jan 29 20:59:44 2023 +0000

    crashtesting: crash in ReadQsiforum-mso-en4-30276.xls

as the workaround should no longer be needed.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I8a3ac88d49464bb1fdd71f826183a82477adcd22
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9289
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 61037a6fced9d1b4b741002df99b986e48353aed)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209467
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-22 01:11:06 +02:00
Caolán McNamara 2be1bbcc11 dbase: apply one consistent key-per-page limit in the .ndx index
db_maxkeys came from the index header, the key count of a page came from the
page itself, and node access used neither. Now the header value is capped to
the number of keys a DINDEX_PAGE_SIZE page can hold for the given key length,
each page keeps its own capacity and caps its key count to it, and node
positions are clamped to the same bound, so all three agree.

ODbaseIndex::CreateImpl worked out db_maxkeys from a four byte page header
while the reader counts eight bytes of page header, so use eight here too and
write an index the reader agrees with.

ONDXPage::Remove asserted on a position past the key count and then carried on
regardless, so return early instead.

ONDXPage::Merge added the key counts of two pages together in a sal_uInt16, so
widen the sum to sal_uInt32.

nValue was a file-level static shared by the page read and write operators for
no reason, so make it a local in the reader and write rPage.nCount directly.

The two GetChild overloads would load a child page that is already on the chain
of parents the descent came down, so leave such a page unread rather than
descending into a page we are inside. ONDXPage::Merge and ONDXPage::PrintPage
can then be handed a page that was left unread, so both check for one with
nothing loaded.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Id51bf8368099447df41aaacbaebba7783c5769e2
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9518
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit db92d0be756305ec0b1e122a1d00333477c17ba5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209449
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-21 18:46:30 +02:00
Caolán McNamara 744b0e2a99 sc: take std::unique_ptr<ScRangeData> in ScRangeName::insert
insert always took ownership of the raw pointer, so make that
visible in the signature and drop the manual delete branches
the callers no longer need

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iaf52cee659c297190d75e70c15a667bd6209d1a2
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9245
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 8ba26c1cf0cc930973dd29e13fe2ccb1fe5c4311)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209454
Tested-by: Jenkins
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-21 16:26:22 +02:00