Commit Graph
100 Commits
Author SHA1 Message Date
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
Caolán McNamara 97d726a023 ScRangeName::insert: update an existing same-name entry in place
inserting under a name that is already present used to erase the old
map node and add a new one, so the container ended up with a different
object for the same name.

so move the values of the new entry into the existing one instead, and
return the surviving entry rather than a bool so callers continue with
the one object that now holds the values.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib8a5a949caccf5b3ebcf24d9109848b0eac42694
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9244
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 4ebe359891e7eafb0f456bc7abc760872a6df5e9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209453
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-21 16:26:15 +02:00
Caolán McNamara df8df5fb71 don't build the nss command line tools
only the nss shared libraries are used, the tools under nss/cmd like
certutil and pk12util are never installed or run

make the build a little faster

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I8b906983f55bc21f3161d9f029fca1afaab02c8b
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9500
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 302f1dd5e6a8d21576ca20803814da14ba0d8193)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209447
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-21 13:17:20 +02:00
Caolán McNamara 1bc7372569 share the four copies of SanitizePaletteIndex
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iaf7640a2be687edda1ed31932eae7c19b4678ec5
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9266
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit af2c9801021e42e0d327994cde0a8529450c6135)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209448
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-21 12:19:24 +02:00
Caolán McNamara c0622dcad4 crashtesting: odt export duplicated a paragraph-anchored text frame
saving fdo66811-1.odt back to odt writes its one paragraph-anchored
text frame twice into content.xml. on a dbgutil build the save
asserts in XMLTextParagraphExport::RecordNodeIndex with:

xmloff/source/text/txtparae.cxx:1826: Assertion `it == maDocumentNodeOrder.end() || isInShapesTextFrame(xTextContent)' failed.

a problem since:

commit 98ae340307
Date:   Fri Apr 22 19:26:47 2022 +0200

    tdf#135978 sw_redlinehide: recreate fly frames anchored to subsequent nodes

which recreates the flys of nodes merged under a redline frame on the
assumption that each node's own frame was deleted. here the anchor
node survived a join with its fly frame still attached, so the export's
redline flag flip made AppendObj create a second SwFlyAtContentFrame
on the same anchor frame, and the UNO layer reported the text frame
twice.

so check for an already attached fly before creating another one.
SwFlyFrameFormat::MakeFrames already does this before it creates a
fly, so factor its check out into FindFlyFrameOfFormat and call that
from both places.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I8fb148288844ee44c0318b8c760130ee2da488da
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9280
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit f095944cb1dfc278e726859bcb792f84c67a6adb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209394
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-21 09:53:48 +02:00
Caolán McNamara d70403b9c6 crashtesting: skip the deferred-break split in headers on the run path too
same fix as:

commit 671b1b51f26fbb8630d1f0022a6d2771bba938db
Date:   Wed Jun 10 15:31:58 2026 +0000

    crashtesting: skip the deferred-break paragraph split in headers and footers

that guarded the paragraph-mark branch of lcl_utext but not the run
branch beside it, which does the same finishParagraph plus
lcl_startParagraphGroup and pushes a CONTEXT_PARAGRAPH with no matching
pop. A column break as the first run of a header paragraph, followed by
text, flushes through the run branch, so tdf89392-1 still tripped the
stack-balance assert at the end of substream().

Reproduced with tdf89392-1.odt converted to docx and reloaded, dbgutil
build:

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

 #21 writerfilter::dmapper::DomainMapper_Impl::substream at sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx:10400
 #22 writerfilter::dmapper::DomainMapper::lcl_substream at sw/source/writerfilter/dmapper/DomainMapper.cxx:5018
 #23 writerfilter::LoggedStream::substream at sw/source/writerfilter/dmapper/LoggedResources.cxx:272
 #24 writerfilter::ooxml::OOXMLDocument::resolveFastSubStreamWithId at sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx:133
 #25 writerfilter::ooxml::OOXMLDocument::resolveHeader at sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx:399
 #26 writerfilter::ooxml::OOXMLFastContextHandler::resolveHeader at sw/source/writerfilter/ooxml/OOXMLFastContextHandler.cxx:897
 #27 writerfilter::ooxml::OOXMLHeaderHandler::finalize at sw/source/writerfilter/ooxml/Handler.cxx:214

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib1126759fca9ff7772a573b7737817fb5f1f3ee7
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/6704
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit c1637ff78d7acd3fe8c081f7a4aefdd1a47910fb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209376
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-20 13:55:17 +02:00
Caolán McNamara a9b60f8ba5 crashtesting: segv on loading rtf export of tdf136042-1.odt
reproduce by loading bugtrackers/odt/tdf136042-1.odt, exporting to rtf, and
loading the exported rtf, which crashes with:

    #0  SwLineLayout::GetLineSpacingBaseHeight (this=0x0) at porlay.hxx:183
    #1  SwTextFormatter::CalcRealHeight at itrform2.cxx:2442
    #2  SwTextFormatter::NewFootnotePortion at txtftn.cxx:820
    #3  SwTextFormatter::NewExtraPortion at txtfld.cxx:290
    #4  SwTextFormatter::NewPortion at itrform2.cxx:1891
    #5  SwTextFormatter::BuildPortions at itrform2.cxx:809
    #6  SwTextFormatter::BuildMultiPortion at pormulti.cxx:2202
    #7  SwTextFormatter::BuildPortions at itrform2.cxx:643

since:

commit 67a3d5c2b579d9db74ad575e45c1f554024ba0f7
Date:   Thu May 28 17:28:23 2026 -0400

    tdf#172233 sw: apply line spacing gap after the line, not before

BuildMultiPortion points m_pCurr at the nested lines of the multi-portion but
leaves alone the previous line the iterator cached for the paragraph, so GetPrev
returns that stale state, still null on the first line.

so skip the previous line lookup while a multi-portion is being formatted.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I9bd4cf33e34936263a67dc104a12258c1eabe244
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9580
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit d0c2aed19e4e99c33261a294b947d8ef7f502eea)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209375
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-20 13:05:01 +02:00
Caolán McNamara 8e5b43e5fb crashtesting: make exported defined names unique without regard to case
forums/xls/forum-mso-en4-62141.xls failed to reload its own xls
round-trip output.

GetUnusedName compared candidate names case-sensitively, so it could
emit two defined names differing only in case, and the import matches
defined names without regard to case, so the two clash on reload.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ifb199e9f4fcefe27476a56d3660c4c87b69ef90b
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9185
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit e5a3a0ffc32071c68923267b12cb4dd8f437ac44)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209313
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-19 13:16:49 +02:00
Caolán McNamara 9f9e3ad8bb crashtesting: drop assert now, fires on bogus cases
and not on any real case

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: If0cd87752beac5560ca96db279e5e4ba2fe327f0
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9150
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit dc4606362eb6852828b114ef05f29545f4855fd9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209312
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-19 12:58:27 +02:00
Caolán McNamara 1f486a45b1 emf+: read path gradient boundary points without point types
This is the variant of an array with no point-type bytes, but by default
EMFPPath::Read consumed trailing bytes as point types.

EMFPPath already has a way to set that the points are a plain
EmfPlusPointF array with no point-type bytes. So use that.

Then the GetRawPointsPolygon workaround is no longer needed.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0cfb9730efd2e9b638da9b2dc5118e4f05293fed
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9133
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 14c378ac439cdc0525d3f76509ca59090aa3b253)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209311
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-19 12:29:51 +02:00
Caolán McNamara ea81d3165e rename the somewhat misleading EMFPPath "Lines" argument to HasPointTypes
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I12d8440f32bf7dd0f6de14e0a4e2603f0223f39d
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9132
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 0cb865c311aa8a4c2001411df6162ecdc6b226ad)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209310
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-19 12:29:46 +02:00
Caolán McNamara 78bb27842a ofz#542668507 Integer-overflow
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I66dc24b6e788c886f6039603dd445bcbcf50b2d7
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9105
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit dc07a9597ee8f60ff0691b82ef7e461adce29f19)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209309
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-19 12:29:37 +02:00
Caolán McNamara f43b311b97 fix ofz build: ParseDictionaryFile: error in line 90 at "\headerf"
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iedc318f6d87bf625196dd44decbbf825ed55a1d2
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9144
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 137e726efddd393548f4ee535076e0c14683e7af)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209308
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-19 12:29:27 +02:00
Caolán McNamara 4dc10d60db firebird: call writeFile outside the SAL_WARN_IF condition
a product build doesn't evaluate the condition, so none of the conf
files were written there.

since:

commit b8407b18adf3c6d552d54d7b6657539e2769afd6
Date:   Tue Jul 28 17:08:38 2026 +0000

    firebird: name the modules of a system firebird by absolute path

and:

commit 6ab71a109bd8a8335208c9faa37a3cfa94523148
Date:   Tue Jul 28 11:05:37 2026 +0000

    Resolves: tdf#172935 Connection from Base to external firebird database refused

Change-Id: I8c66ae59774a161c8c135b2dea772810d92495dd
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/8183
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/8282
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit ee9ee3e66d88c712c4374635ca9057292012fe32)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209295
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-19 00:20:50 +02:00
Caolán McNamara 07168ae71d html import: only resolve the data url of an <object> if it has a data attribute
with a document loaded from file:///tmp/doc.html a data attribute
resolves as wanted:

    <object data="movie.mp4"/>  ->  file:///tmp/movie.mp4

but with only a src attribute the empty data string resolved against
the base url and replaced the src url already in aURLObj with the
document's own url:

    <object src="movie.mp4"/>   ->  file:///tmp/doc.html

now that case keeps its src url:

    <object src="movie.mp4"/>   ->  file:///tmp/movie.mp4

since:

commit c40afac8a3
Date:   Mon Mar 5 17:29:51 2018 +0100

    sw XHTML import: map <object> to OLE objects

Change-Id: Ie18ce1ef35a55e618c126db050b0864b342b59df
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8383
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 161009e7f14768d6c37620f722c00fb1f1bc3bee)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209249
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-18 16:01:48 +02:00
Caolán McNamara fb7df72df2 add FODP to the test filter list, alongside FODG, FODS and FODT
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0d5aaac7005588d71939a2dc7230f8aa4ab41552
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9343
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 3e00a1509b44acb7c510c46827f2e840cd1619aa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209250
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-18 15:55:38 +02:00
Caolán McNamara 308729b593 crashtesting: take the footnotes back with the text joined into the master
reproduce by loading forum-mso-de-31447 and exporting it to pdf, reduced here
to the sw/qa/core/text/data/footnote-follow-join.fodt of this commit

a footnote frame is left pointing at a text frame that was already destroyed:

    #0  SwFrame::IsBodyFrame (this=0x5) at sw/source/core/inc/frame.hxx:1259
    #1  SwFootnoteBossFrame::FindBodyCont at sw/source/core/layout/findfrm.cxx:52
    #2  SwFootnoteBossFrame::SetFootnoteDeadLine (nDeadLine=35945) at sw/source/core/layout/ftnfrm.cxx:2644
    #3  SwSaveFootnoteHeight::SwSaveFootnoteHeight (nDeadLine=35945) at sw/source/core/layout/ftnfrm.cxx:3032
    #4  SwContentFrame::MakeAll at sw/source/core/layout/calcmove.cxx:1397
    #5  SwFrame::OptPrepareMake at sw/source/core/layout/calcmove.cxx:420
    #6  SwFrame::OptCalc at sw/source/core/inc/frame.hxx:1135
    #7  SwLayAction::FormatContent_ at sw/source/core/layout/layact.cxx:2041
    #8  SwLayAction::FormatContent at sw/source/core/layout/layact.cxx:1847
    #9  SwLayAction::InternalAction at sw/source/core/layout/layact.cxx:639
    #10 SwLayAction::Action at sw/source/core/layout/layact.cxx:404
    #11 SwViewShell::CalcLayout at sw/source/core/view/viewsh.cxx:1313
    #12 SwEditShell::CalcLayout at sw/source/core/edit/edws.cxx:89
    #13 SwXTextDocument::getRendererCount at sw/source/uibase/uno/unotxdoc.cxx:2788
    #14 PDFExport::Export at filter/source/pdf/pdfexport.cxx:1147

When CalcFollow pulls text back from the follow, the follow's offset moves
forward past that text. Any footnote of the moved text is then outside the
follow's range, so nothing removes its footnote frame and it keeps pointing
at a text frame the layout later destroys. Remove those footnotes before the
new offset is set.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iea3207159559434560ce869eed7c501f951ac940
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7988
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit 82e71e2fcd1ea124c12d991134dba1b69002a139)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208888
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-31 17:07:49 +02:00
Caolán McNamara d66d99a5b9 vcl: test for an empty palette in the psd and ras SanitizePaletteIndex
The ipict and dibtools copies of this helper already do this, so just
fix this up for general consistency.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ied9c6915180049d4f94d4bb6f32ef9b37bb5b272
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8145
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit cf1ffb43a2005ed811c2f39525b3e44cb7970037)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208889
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-31 16:54:00 +02:00
Caolán McNamara 09dbbe16b0 firebird: name the modules of a system firebird by absolute path
Debian patches firebird to resolve its plugins, intl and conf
directories under the FIREBIRD variable (instead of where it was built)
and we want point that variable at a private directory. But then the
modules aren't loaded and no database opens.

So write a replacement plugins.conf that lists the absolute path of each
plugin module (and the intl conf files) with their macros expanded.

each lib<Name>.so (otherwise found by default) with no entry names gets
an entry of its own.

Change-Id: I2696d7197394b7fe9b7739732deadd2cb2e01acc
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/7989
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit b8407b18adf3c6d552d54d7b6657539e2769afd6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208882
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-31 15:03:50 +02:00
Caolán McNamara 171780211c ofz#540137186 Abrt
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ieee09c5a151119294e6656cf4ddbb7f0a025a1e9
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8066
(cherry picked from commit 1466aac7fb2da367fe3d4165151a9770a2855de3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208842
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-30 23:57:26 +02:00
Caolán McNamara 2d642876e9 ofz: pct, an indexed PixMap needs a colour table to decode
Change-Id: I501a09ef52742266981d52496e77d8c1e1067265
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8143
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 0830584f3d110648aeb0399c5632cabbb8924dcb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208841
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-30 23:57:21 +02:00
Caolán McNamara d9d87d79ce ofz: rtf, limit \bin reads to the bytes left in the stream
Change-Id: I3a1167fe65e9b3e86502707fa796c21b2846a6e8
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8142
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 72f836bfd346ca5d62a1f9bc2f3c3d5d4cd87b8c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208840
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-30 18:13:37 +02:00
Caolán McNamara 99bf522289 Resolves: tdf#172935 Connection from Base to external firebird database refused
there is one firebird engine per process and it reads its configuration once
from the directory we set up, so a .fdb the user picked somewhere else could
not be attached. firebird resolves a name in databases.conf before it treats
it as a path, so give the file a name there and pass firebird that name,
dropped again when the connection is disposed.

since:

commit 520d8173cef39a4da85b3ba21bdaaa3150384c25
Date:   Sun Jul 12 12:10:41 2026 +0000

    firebird: keep each embedded database's files in one directory

Change-Id: I4872a4e2165c4701bfb20be5dcd8c119b1723125
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/7990
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit 6ab71a109bd8a8335208c9faa37a3cfa94523148)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208773
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-30 15:54:50 +02:00
Caolán McNamara 053a52ec3d crashtesting: tolerate a not-yet-repositioned fieldmark in sw::CalcBreaks
reproduce with a dbgutil build loading forum-mso-en-4208.docx

    sw/source/core/crsr/bookmark.cxx:294
    sw::mark::Fieldmark::IsCoveringPosition(this=0x0)

writerfilter field import calls InsertFieldmark, which splits the
paragraph. SwTextNode::CutImpl moves the text, which already carries
the CH_TXT_ATR_FIELDSTART/FIELDSEP/FIELDEND dummy characters, to the
destination node before the fieldmarks themselves are repositioned.

relocating a content-control nesting hint then runs sw::CalcBreaks
over the destination node. getFieldmarkAt finds no mark at the
FIELDSTART character and the assert at the FIELDSEP character
dereferences the null pushed for it.

keep pushing the possibly-null mark so start, separator and end stay
paired on the stack, and let the two asserts accept a null top entry.
The loop at the end over the still-open fields already handles a null
mark.

a similar guard existed since:

commit b3325ef8cd
Date:   Sat Nov 6 16:40:17 2021 +0000

    ofz40766 Null-dereference

until:

commit a7116b890c
Date:   Tue Nov 16 14:28:15 2021 +0100

    ofz#40766 svtools, sw: HTMLParser: really stop inserting control chars

removed it when the source of stray control characters was fixed
instead. Here the field characters are legitimate and only the mark
repositioning lags behind.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I9c7a33f5fac614645e420152c490765b53a7004c
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/6714
Tested-by: Michael Stahl <michael.stahl@collabora.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit 274d1402efe96b367be1cf0fdfe7edd3641c9df2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208770
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-29 13:56:08 +02:00
Caolán McNamara cd34738793 ofz: Use-of-uninitialized-value
Uninitialized value was stored to memory at
   #0 0x5ad2b779b7f8 in size /usr/local/include/c++/v1/__vector/vector.h:396:56
   #1 0x5ad2b779b7f8 in erase<utl::ConfigItem *, std::__1::allocator<utl::ConfigItem *>, utl::ConfigItem *> /usr/local/include/c++/v1/__vector/erase.h:31:25
   #2 0x5ad2b779b7f8 in utl::ConfigManager::removeConfigItem(utl::ConfigItem&) /src/libreoffice/unotools/source/config/configmgr.cxx:160:5
   #3 0x5ad2b7798e0c in utl::ConfigItem::~ConfigItem() /src/libreoffice/unotools/source/config/configitem.cxx:164:39
   #4 0x5ad2b780fd24 in SvtSysLocaleOptions_Impl::~SvtSysLocaleOptions_Impl() /src/libreoffice/unotools/source/config/syslocaleoptions.cxx:257:1
   #5 0x5ad2b78148ff in __release_shared /usr/local/include/c++/v1/__memory/shared_count.h:92:7
   #6 0x5ad2b78148ff in __release_shared /usr/local/include/c++/v1/__memory/shared_count.h:121:25
   #7 0x5ad2b78148ff in ~shared_ptr /usr/local/include/c++/v1/__memory/shared_ptr.h:561:17
   #8 0x5ad2b78148ff in reset /usr/local/include/c++/v1/__memory/shared_ptr.h:611:50
   #9 0x5ad2b78148ff in SvtSysLocaleOptions::~SvtSysLocaleOptions() /src/libreoffice/unotools/source/config/syslocaleoptions.cxx:563:11
   #10 0x5ad2b78963ac in SvtSysLocale_Impl::~SvtSysLocale_Impl() /src/libreoffice/unotools/source/misc/syslocale.cxx:88:1
   #11 0x5ad2b7898111 in __release_shared /usr/local/include/c++/v1/__memory/shared_count.h:92:7
   #12 0x5ad2b7898111 in __release_shared /usr/local/include/c++/v1/__memory/shared_count.h:121:25
   #13 0x5ad2b7898111 in ~shared_ptr /usr/local/include/c++/v1/__memory/shared_ptr.h:561:17
   #14 0x5ad2b7898111 in reset /usr/local/include/c++/v1/__memory/shared_ptr.h:611:50
   #15 0x5ad2b7898111 in SvtSysLocale::~SvtSysLocale() /src/libreoffice/unotools/source/misc/syslocale.cxx:142:11
   #16 0x5ad2b867a496 in ImplAllSettingsData::~ImplAllSettingsData() /src/libreoffice/vcl/source/app/settings.cxx:2521:1
   #17 0x5ad2b867ac16 in ~impl_t /src/libreoffice/include/o3tl/cow_wrapper.hxx:170:16
   #18 0x5ad2b867ac16 in release /src/libreoffice/include/o3tl/cow_wrapper.hxx:201:17
   #19 0x5ad2b867ac16 in ~cow_wrapper /src/libreoffice/include/o3tl/cow_wrapper.hxx:265:13
   #20 0x5ad2b867ac16 in AllSettings::~AllSettings() /src/libreoffice/vcl/source/app/settings.cxx:2525:27
   #21 0x5ad2b86a5894 in ~__optional_destruct_base /usr/local/include/c++/v1/optional:301:15
   #22 0x5ad2b86a5894 in ImplSVAppData::~ImplSVAppData() /src/libreoffice/vcl/source/app/svdata.cxx:571:34
   #23 0x5ad2b86a4c20 in ImplSVData::~ImplSVData() /src/libreoffice/vcl/source/app/svdata.cxx:563:28
   #24 0x5ad2b10fcccb in MSanCxaAtExitWrapper(void*) /src/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:1311:3

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I1ab186c8456aebc719657215ac9cd0fa3e777589
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7895
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit b91cb7428e620f5c34c2ff94d7f8ce2a7d494c62)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208774
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-29 13:51:24 +02:00
Caolán McNamara 4aee95b7fb ofz#539034285 check for invalid encoding indexes
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie5039411e1363fec7ee60be999751ce5d9e71153
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7874
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit d6ad752c9e89c84e487458d92e7ffa0886a4cd4d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208768
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-29 13:45:24 +02:00
Caolán McNamara ad9e26606f sc: fold hasExternalContentLinks into one hasUpdatableLinks predicate
At this point every link that can be in the list is already either
one of the things specifically checked for, or is an obscure corner
case that if it does start to appear in the list should be checked.

So collapse this to its simpler reality.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6103819c5f93f7d32caa6a47e0f147db2de744c8
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/7236
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7532
(cherry picked from commit ebe9aa73a61045e47d22eddbe454ada2c3dfca21)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208772
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-29 12:54:35 +02:00
Caolán McNamara ced55a8844 sc: gather the external-link checks into one HasExternalLinks
merge the various individual link checks into one HasExternalLinks
check.

Keep the DocumentLinkManager hasDdeLinks special case, and change
the other to be hasExternalContentLinks

ScDocument::HasAreaLinks is only called when we're asking about
HasExternalLinks so fold that in and bring some of the sprawling crazy
under control

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6cf35d7ef7ae1c53ad9e87e0b36849ded4ae8323
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/7235
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7381
(cherry picked from commit f15965091e84bb5d51a7e4809089d493f74f2c10)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208771
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-29 12:54:15 +02:00
Caolán McNamara e13e59d2e5 sc: skip the row height recompute on a column insert
A horizontal insert only adds empty cells and shifts existing cells
sideways, so no row's optimal height can change. It recomputed heights
over the whole row extent anyway, freezing the document thread on a tall
sheet.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib2936edbbf560f247dcbce6d75fa725f3193e2c7
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7527
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 05583ef6a07f588a5262a377b01c65eaf24a1b2a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208767
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-29 12:35:08 +02:00
Caolán McNamara bef421f6d0 crashtesting: clone a matrix cell's result when it's not refcounted
A matrix formula cell holds the "top-left" result of its matrix in the
reference-counted xUpperLeft of ScMatrixFormulaCellToken.

CloneUpperLeftIfNecessary cloned that only for svDouble; other types
were kept by shared reference.

But threaded group calculation switches every token in the group's shared pCode
to RefCntPolicy::None while worker threads interpret it, on the basis that
interpreting only reads pCode, since:

commit 791a2489ee
Date:   Sun Mar 24 21:31:38 2024 +0000

    Related: tdf#160056 elide ref counting for initial tokens

A matrix formula whose result is a string constant from its own pCode
broke that: the pCode token was taken as the upper left during the None
window, so its IncRef was a no-op.

At teardown the matrix released it and freed a token the pCode array
still pointed at.

Where the uncounted reference is taken:

    #1 boost::intrusive_ptr<formula::FormulaToken const>::operator=
         boost/smart_ptr/intrusive_ptr.hpp:121
    #2 ScMatrixFormulaCellToken::Assign         sc/source/core/tool/token.cxx
    #3 ScFormulaResult::SetToken                sc/source/core/tool/formularesult.cxx:206
    #4 ScFormulaResult::Assign                  sc/source/core/tool/formularesult.cxx:171
    #5 ScFormulaCell::InterpretTail             sc/source/core/data/formulacell.cxx:2476
    #6 ScColumn::CalculateInThread              sc/source/core/data/column2.cxx:3266
    #7 ScTable::CalculateInColumnInThread       sc/source/core/data/table1.cxx:2715
    #8 ScDocument::CalculateInColumnInThread    sc/source/core/data/documen8.cxx:420
    #9 ...Executor::doWork()                    sc/source/core/data/formulacell.cxx:5437
    #10 comphelper::ThreadTask::exec

Clone the upper left when it is svDouble (as before) or not reference counted
(RefCntPolicy::None). The clone is a counted token the cell owns, so no
reference into pCode is taken during the threaded window. The non-threaded
path is unchanged.

Also assert in HandleStuffAfterParallelCalculation that a matrix result's
upper left does not alias the cell's own pCode.

Found with an ASan+UBSan build reloading crashtest document
forum-mso-en4-676909.

The original motivating tdf#160056 benchmark document never visits this
clone branch, so that case remains unchanged.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ibd9e93aa9e59fabb99941a92a16aef247f7ae160
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5638
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 2a70b7a75ce8768e077ea42175e59465d3adba31)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208769
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-29 11:46:30 +02:00
Caolán McNamara 0aeb164f0f 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

Change-Id: Id9fd49245fbfe2d62d767e3cb04370b2e5197fe1
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>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7961
(cherry picked from commit 82f3a17f461fb2d0057cc81625f7ae1e301db3ad)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208739
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-28 20:00:45 +02:00
Caolán McNamara efdb9e6deb crashtesting: only report a fly for its own anchor node
reproduce by converting doc/forum-mso-de-53089.doc to odt, which asserts on a
paragraph whose node index was recorded twice:

    xmloff/source/text/txtparae.cxx:1826: Assertion
    `it == maDocumentNodeOrder.end()
     || isInShapesTextFrame(xTextContent)' failed.

when a paragraph mark is hidden the paragraph that follows it is laid out in
the same text frame.

that one text frame has the objects anchored in every node it covers.

CollectFrameAtNode is asked about one node at a time, so its layout branch
listed the fly for each of the merged nodes and the odt export wrote it twice.

the branch that runs without a layout already takes only the objects whose
anchor node is the node it was asked about, so now both branches answer alike.

a node hidden inside a merged text frame keeps its own objects either way,
as the merged frame is reachable from every node it covers.

the assert shows up on this document since:

commit 9df0b0af0743923e84722cec3a452e15b35963cf
Date:   Fri Jun 12 15:37:29 2026 -0400

    tdf#164800 doc import: don't limit RES_PARATR_LIST_AUTOFMT to SwNumRule

which fills RES_PARATR_LIST_AUTOFMT for every paragraph imported from DOC,
hidden paragraph marks included, so HideIterator merges nodes that never
merged before.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ice2d156c04e763bca25e4e623f82304ed31e63e0
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7885
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 5c23db772b3164b18ade74c40637d0cb35a31c33)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208726
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-28 16:01:07 +02:00