[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 23 commits - desktop/source filter/source include/vcl libreofficekit/qa lotuswordpro/qa lotuswordpro/source sc/source sfx2/source sw/source vcl/source vcl/unx writerfilter/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Tue Mar 23 08:31:57 UTC 2021
desktop/source/lib/init.cxx | 6 -
filter/source/graphicfilter/icgm/bitmap.cxx | 10 ++
filter/source/msfilter/msdffimp.cxx | 15 ++-
include/vcl/BitmapTools.hxx | 3
libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx | 5 +
lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp |binary
lotuswordpro/source/filter/lwprowlayout.cxx | 12 ++-
lotuswordpro/source/filter/lwptablelayout.cxx | 9 ++
sc/source/filter/oox/workbookhelper.cxx | 7 -
sfx2/source/doc/sfxbasemodel.cxx | 60 ++++++++++-----
sw/source/core/doc/DocumentRedlineManager.cxx | 2
sw/source/core/edit/autofmt.cxx | 11 +-
sw/source/core/text/txtfrm.cxx | 2
sw/source/filter/basflt/fltshell.cxx | 32 +++++++-
sw/source/filter/html/htmlgrin.cxx | 2
sw/source/filter/html/htmltab.cxx | 35 --------
sw/source/filter/html/swhtml.cxx | 21 +++++
sw/source/filter/html/swhtml.hxx | 11 ++
sw/source/filter/inc/fltshell.hxx | 22 +++++
sw/source/filter/ww8/docxexport.cxx | 4 -
sw/source/filter/ww8/ww8par.cxx | 3
sw/source/filter/ww8/ww8par.hxx | 2
sw/source/filter/ww8/ww8par2.cxx | 12 +--
sw/source/filter/ww8/ww8par6.cxx | 2
sw/source/filter/ww8/ww8scan.cxx | 37 ++++++---
sw/source/filter/ww8/ww8scan.hxx | 6 +
sw/source/uibase/app/docst.cxx | 19 ++--
vcl/source/font/fontcharmap.cxx | 18 ++--
vcl/unx/generic/app/i18n_cb.cxx | 4 -
writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 2
30 files changed, 247 insertions(+), 127 deletions(-)
New commits:
commit 9a53a3bcb9a282090ae2a52442e31e5b1225a1ce
Author: Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Thu Jan 14 20:10:24 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:04 2021 +0100
tdf#135014 sw_redlinehide: fix missing frames when removing fieldmark
A fieldmark was deleted. UpdateFramesForRemoveDeleteRedline() deleted
the MergedPara but its start node was before the start node of the
fieldmark, and then MakeFrames() didn't find a frame on the preceding
node and did nothing.
Similar problem likely possible with redline.
Change-Id: I532f9a67c0268f3287736a61da4cc9fefec7b8e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109307
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
(cherry picked from commit 32e104c1d6be0ffe6ed6c4e08af868c87b3c258c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109347
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index ff9b05743d10..8ae32f266bdb 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -301,6 +301,8 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
pFrame->SetMergedPara(sw::CheckParaRedlineMerge(
*pFrame, rFirstNode, eMode));
eMode = sw::FrameMode::New; // Existing is not idempotent!
+ // update pNode so MakeFrames starts on 2nd node
+ pNode = &rFirstNode;
}
}
if (pLast != pNode)
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index f6927730edc6..46957b4448f8 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1292,6 +1292,8 @@ void SwTextFrame::SetMergedPara(std::unique_ptr<sw::MergedPara> p)
pFirst->Add(this); // must register at node again
}
}
+ // postcondition: frame must be listening somewhere
+ assert(m_pMergedPara || GetDep());
}
const OUString& SwTextFrame::GetText() const
commit 1fcec627070450aec3611d6a4a008f8153612a64
Author: Justin Luth <justin_luth at sil.org>
AuthorDate: Fri Jan 15 20:32:43 2021 +0300
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:04 2021 +0100
tdf#136704 sw autofmt: prevent crash if no nextNode
The second GetNextNode() was a nullptr
that was being dereferenced.
Now, when enter is pressed after some text followed by a colon,
that line is made into a heading3, and the new blank line is
properly using the text body paragraph style.
Change-Id: If10dc85e490ac57fc150b3d541f5033dfd5293bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109413
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
(cherry picked from commit fea7b531a4c9e8326a644cccc26325b16585675a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109520
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 591c4a988d20..a3925246f32f 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -1895,11 +1895,14 @@ void SwAutoFormat::BuildHeadLine( sal_uInt16 nLvl )
JoinPrevPara();
DeleteLeadingTrailingBlanks( true, false );
- const SwTextFrame *const pNextFrame = GetNextNode(false);
- (void)DeleteJoinCurNextPara(pNextFrame, true);
-
+ const SwTextFrame* pNextFrame = GetNextNode(false);
+ if (pNextFrame->GetNext())
+ {
+ (void)DeleteJoinCurNextPara(pNextFrame, true);
+ pNextFrame = GetNextNode(false);
+ }
m_aDelPam.DeleteMark();
- m_aDelPam.GetPoint()->nNode = *GetNextNode(false)->GetTextNodeForParaProps();
+ m_aDelPam.GetPoint()->nNode = *pNextFrame->GetTextNodeForParaProps();
m_aDelPam.GetPoint()->nContent.Assign( m_aDelPam.GetContentNode(), 0 );
m_pDoc->SetTextFormatColl( m_aDelPam, &rNxtColl );
}
commit 5c90f4435c8210280676a2e40b8735d9fff1142e
Author: Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Fri Jan 22 21:08:45 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:04 2021 +0100
fix -Wmaybe-uninitialized
Change-Id: I0dc16e51ea45069ae207c6440db879143d89cf2c
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index d64192c115e4..2d3ea9f328a9 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1686,7 +1686,7 @@ void OOXMLFastContextHandlerShape::sendShape( Token_t Element )
if (mnTableDepth > 0 && mbLayoutInCell) //if we had a table
{
uno::Reference<beans::XPropertySet> xShapePropSet(xShape, uno::UNO_QUERY);
- sal_Int16 nCurrentHorOriRel; //A temp variable for storaging the current setting
+ sal_Int16 nCurrentHorOriRel = {}; // spurious -Werror=maybe-uninitialized
xShapePropSet->getPropertyValue("HoriOrientRelation") >>= nCurrentHorOriRel;
//and the correction:
if (nCurrentHorOriRel == com::sun::star::text::RelOrientation::PAGE_FRAME)
commit 54d9c0d3e7cfd2776987535b45b20376a62ecd59
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Dec 9 15:18:06 2019 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:04 2021 +0100
Use o3tl::doAccess, prevent -Werror=maybe-uninitialized
Change-Id: Id30119c03dbbe0b3befe17cdb0bdb5f2943097ce
Reviewed-on: https://gerrit.libreoffice.org/84753
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
(cherry picked from commit 7ba2d77dc2b920978f6084ae6223b6828f32bcd3)
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 3e25780e00cb..8c484bfa8897 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -41,6 +41,7 @@
#include <sal/log.hxx>
#include <vcl/errinf.hxx>
#include <vcl/lok.hxx>
+#include <o3tl/any.hxx>
#include <osl/file.hxx>
#include <osl/process.h>
#include <osl/thread.h>
@@ -3980,17 +3981,16 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
int nLeft = OutputDevice::LogicToLogic(aChartBB.Left(), MapUnit::MapTwip, MapUnit::Map100thMM);
int nTop = OutputDevice::LogicToLogic(aChartBB.Top(), MapUnit::MapTwip, MapUnit::Map100thMM);
- sal_Int32 value;
for (beans::PropertyValue& rPropValue: aPropertyValuesVector)
{
if (rPropValue.Name == "TransformPosX" || rPropValue.Name == "TransformRotationX")
{
- rPropValue.Value >>= value;
+ auto const value = *o3tl::doAccess<sal_Int32>(rPropValue.Value);
rPropValue.Value <<= value - nLeft;
}
else if (rPropValue.Name == "TransformPosY" || rPropValue.Name == "TransformRotationY")
{
- rPropValue.Value >>= value;
+ auto const value = *o3tl::doAccess<sal_Int32>(rPropValue.Value);
rPropValue.Value <<= value - nTop;
}
}
commit 8e19fb1aa51ae01ae1b4b301e841af42392defb9
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Dec 3 13:35:49 2019 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:03 2021 +0100
Use o3tl::doAccess, prevent -Werror=maybe-uninitialized
Change-Id: Id40ebafeb227c432af8689b7db246a3615bc482b
Reviewed-on: https://gerrit.libreoffice.org/84344
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
(cherry picked from commit 1bfd91e1b319012b93fca144b9133d816150c27e)
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index b19aa700ca8c..5cfa569894f4 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/document/XViewDataSupplier.hpp>
+#include <o3tl/any.hxx>
#include <osl/thread.h>
#include <osl/diagnose.h>
#include <oox/helper/progressbar.hxx>
@@ -761,14 +762,12 @@ void WorkbookHelper::finalizeWorkbookImport()
OUString sName(rProp.Name);
if (sName == SC_POSITIONLEFT)
{
- SCCOL nPosLeft;
- rProp.Value >>= nPosLeft;
+ SCCOL nPosLeft = *o3tl::doAccess<SCCOL>(rProp.Value);
getScDocument().SetPosLeft(nPosLeft);
}
else if (sName == SC_POSITIONTOP)
{
- SCROW nPosTop;
- rProp.Value >>= nPosTop;
+ SCROW nPosTop = *o3tl::doAccess<SCROW>(rProp.Value);
getScDocument().SetPosTop(nPosTop);
}
}
commit 62fdb75a163a69a18355848514d3efe50aa315b3
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Dec 3 13:26:52 2019 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:03 2021 +0100
Use o3tl::doAccess, prevent -Werror=maybe-uninitialized
Change-Id: I6a86db428dcf92083ee13298417b3d3027e45822
Reviewed-on: https://gerrit.libreoffice.org/84338
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
(cherry picked from commit 4e62db5876bac758904bb9fcc669f943a03d4c7a)
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 74745f68f604..ad5104b6dd7f 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -86,6 +86,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/storagehelper.hxx>
+#include <o3tl/any.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <vcl/font.hxx>
@@ -1214,8 +1215,7 @@ void DocxExport::WriteSettings()
}
else if (rProp.Name == "HyphenationZone")
{
- sal_Int16 nHyphenationZone;
- rProp.Value >>= nHyphenationZone;
+ sal_Int16 nHyphenationZone = *o3tl::doAccess<sal_Int16>(rProp.Value);
if (nHyphenationZone > 0)
pFS->singleElementNS(XML_w, XML_hyphenationZone, FSNS(XML_w, XML_val),
OString::number(nHyphenationZone));
commit f08186baf39a85bb8c6b4b52e9b02e5970eb1384
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Dec 3 13:25:39 2019 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:03 2021 +0100
Use o3tl::doAccess, prevent -Werror=maybe-uninitialized
(and do not unbox Any where it is not necessary anyway)
Change-Id: Ic5461fb8b62157e9116cd2d557ee38fface28fb7
Reviewed-on: https://gerrit.libreoffice.org/84337
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
(cherry picked from commit 941d53eee9a186e790bb3203b37eeb5fa285d2c4)
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 2e25b89ea9e6..580aee5ad8bd 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -24,7 +24,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <comphelper/flagguard.hxx>
-
+#include <o3tl/any.hxx>
#include <sal/log.hxx>
#include <hintids.hxx>
#include <sfx2/app.hxx>
@@ -717,21 +717,20 @@ void syncEndnoteOrientation(const uno::Reference< style::XStyleFamiliesSupplier
return;
}
- sal_Int32 nWidth, nHeight;
- bool bIsDefLandScape, bIsEndLandScape;
-
- xDefaultPagePropSet->getPropertyValue("IsLandscape") >>= bIsDefLandScape;
- xEndnotePagePropSet->getPropertyValue("IsLandscape") >>= bIsEndLandScape;
+ auto const bIsDefLandScape = *o3tl::doAccess<bool>(
+ xDefaultPagePropSet->getPropertyValue("IsLandscape"));
+ auto const bIsEndLandScape = *o3tl::doAccess<bool>(
+ xEndnotePagePropSet->getPropertyValue("IsLandscape"));
if (bIsDefLandScape == bIsEndLandScape)
return;
- xEndnotePagePropSet->getPropertyValue("Width") >>= nWidth;
- xEndnotePagePropSet->getPropertyValue("Height") >>= nHeight;
+ auto const nWidth = xEndnotePagePropSet->getPropertyValue("Width");
+ auto const nHeight = xEndnotePagePropSet->getPropertyValue("Height");
xEndnotePagePropSet->setPropertyValue("IsLandscape", css::uno::toAny(bIsDefLandScape));
- xEndnotePagePropSet->setPropertyValue("Width", css::uno::toAny(nHeight));
- xEndnotePagePropSet->setPropertyValue("Height", css::uno::toAny(nWidth));
+ xEndnotePagePropSet->setPropertyValue("Width", nHeight);
+ xEndnotePagePropSet->setPropertyValue("Height", nWidth);
}
}
commit 6222b35340481f98374a276f4ae1cf8251bdc59d
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Dec 4 16:33:54 2019 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:03 2021 +0100
Use o3tl::doAccess, prevent -Werror=maybe-uninitialized
Change-Id: Iff932423bfd1964fa5fa2dfa74de9b7c9b6701f3
Reviewed-on: https://gerrit.libreoffice.org/84423
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
(cherry picked from commit be3a818301a3ed1871bf6d7f57db39ddb6b67ab9)
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index fbb718b732c7..6f660566dac8 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -23,6 +23,8 @@
#include <math.h>
#include <limits.h>
#include <vector>
+
+#include <o3tl/any.hxx>
#include <osl/endian.h>
#include <osl/file.hxx>
#include <tools/solar.h>
@@ -4630,11 +4632,14 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
pAny = aGeometryItem.GetPropertyValueByName( sPath, sCoordinates );
if (pAny && (*pAny >>= seqCoordinates) && (seqCoordinates.getLength() >= 2))
{
- sal_Int32 nL, nT, nR, nB;
- seqCoordinates[0].First.Value >>= nL;
- seqCoordinates[0].Second.Value >>= nT;
- seqCoordinates[1].First.Value >>= nR;
- seqCoordinates[1].Second.Value >>= nB;
+ auto const nL
+ = *o3tl::doAccess<sal_Int32>(seqCoordinates[0].First.Value);
+ auto const nT
+ = *o3tl::doAccess<sal_Int32>(seqCoordinates[0].Second.Value);
+ auto const nR
+ = *o3tl::doAccess<sal_Int32>(seqCoordinates[1].First.Value);
+ auto const nB
+ = *o3tl::doAccess<sal_Int32>(seqCoordinates[1].Second.Value);
aEllipseRect_MS = basegfx::B2DRectangle(nL, nT, nR, nB);
}
commit aea8c002f961dbb551b793e68e2094427a909358
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Dec 3 13:56:57 2019 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:03 2021 +0100
Also throw IllegalArgumentException for arguments of wrong type
Change-Id: I1b52accc3f0eec3e6232b8211bf7bcbf65ed18f8
Reviewed-on: https://gerrit.libreoffice.org/84350
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
(cherry picked from commit ebd70d476c392b2c5a87295e01b8ea9c2e8de258)
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index a297faad0ec8..8c5b2dd87fef 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1063,48 +1063,72 @@ void SAL_CALL SfxBaseModel::setArgs(const Sequence<beans::PropertyValue>& aArgs)
{
OUString sValue;
bool bValue;
-
+ bool ok = false;
if (rArg.Name == "SuggestedSaveAsName")
{
- rArg.Value >>= sValue;
- pMedium->GetItemSet()->Put(SfxStringItem(SID_SUGGESTEDSAVEASNAME, sValue));
+ if (rArg.Value >>= sValue)
+ {
+ pMedium->GetItemSet()->Put(SfxStringItem(SID_SUGGESTEDSAVEASNAME, sValue));
+ ok = true;
+ }
}
else if (rArg.Name == "SuggestedSaveAsDir")
{
- rArg.Value >>= sValue;
- pMedium->GetItemSet()->Put(SfxStringItem(SID_SUGGESTEDSAVEASDIR, sValue));
+ if (rArg.Value >>= sValue)
+ {
+ pMedium->GetItemSet()->Put(SfxStringItem(SID_SUGGESTEDSAVEASDIR, sValue));
+ ok = true;
+ }
}
else if (rArg.Name == "LockContentExtraction")
{
- rArg.Value >>= bValue;
- pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_CONTENT_EXTRACTION, bValue));
+ if (rArg.Value >>= bValue)
+ {
+ pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_CONTENT_EXTRACTION, bValue));
+ ok = true;
+ }
}
else if (rArg.Name == "LockExport")
{
- rArg.Value >>= bValue;
- pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_EXPORT, bValue));
+ if (rArg.Value >>= bValue)
+ {
+ pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_EXPORT, bValue));
+ ok = true;
+ }
}
else if (rArg.Name == "LockPrint")
{
- rArg.Value >>= bValue;
- pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_PRINT, bValue));
+ if (rArg.Value >>= bValue)
+ {
+ pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_PRINT, bValue));
+ ok = true;
+ }
}
else if (rArg.Name == "LockSave")
{
- rArg.Value >>= bValue;
- pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_SAVE, bValue));
+ if (rArg.Value >>= bValue)
+ {
+ pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_SAVE, bValue));
+ ok = true;
+ }
}
else if (rArg.Name == "LockEditDoc")
{
- rArg.Value >>= bValue;
- pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_EDITDOC, bValue));
+ if (rArg.Value >>= bValue)
+ {
+ pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_EDITDOC, bValue));
+ ok = true;
+ }
}
else if (rArg.Name == "Replaceable")
{
- rArg.Value >>= bValue;
- pMedium->GetItemSet()->Put(SfxBoolItem(SID_REPLACEABLE, bValue));
+ if (rArg.Value >>= bValue)
+ {
+ pMedium->GetItemSet()->Put(SfxBoolItem(SID_REPLACEABLE, bValue));
+ ok = true;
+ }
}
- else
+ if (!ok)
{
throw lang::IllegalArgumentException("Setting property not supported: " + rArg.Name,
comphelper::getProcessComponentContext(), 0);
commit 577596fd100ceb4b496a1f74e71660fd6344f00b
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Sep 26 11:38:51 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:03 2021 +0100
Avoid -Werror=nonnull with glibc-headers-x86-2.32-1.fc33.noarch
...on Fedora 33:
> ~/lo/core/vcl/unx/generic/app/i18n_cb.cxx: In function ‘void Preedit_InsertText(preedit_text_t*, XIMText*, int)’:
> ~/lo/core/vcl/unx/generic/app/i18n_cb.cxx:149:34: error: argument 1 is null but the corresponding size argument 3 value is 1024 [-Werror=nonnull]
> 149 | size_t nBytes = wcstombs ( nullptr, pWCString, 1024 /* don't care */);
> | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from ~/gcc/trunk/inst/include/c++/11.0.0/cstdlib:75,
> from ~/lo/core/include/sal/log.hxx:15,
> from ~/lo/core/vcl/unx/generic/app/i18n_cb.cxx:25:
> /usr/include/stdlib.h:937:15: note: in a call to function ‘size_t wcstombs(char*, const wchar_t*, size_t)’ declared with attribute ‘access (write_only, 1, 3)’
> 937 | extern size_t wcstombs (char *__restrict __s,
> | ^~~~~~~~
(Allowing the first argument to wcstombs to be null, and in which case the third
argument is ignored, is a POSIX extension.)
Change-Id: Ic078623643010b7539bc5bc1b498f18977ae77ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103473
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
(cherry picked from commit 782d160458d319c6c77fffa4c003c519afffaa17)
diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx
index e9861dca51d8..4f05e11a5845 100644
--- a/vcl/unx/generic/app/i18n_cb.cxx
+++ b/vcl/unx/generic/app/i18n_cb.cxx
@@ -142,7 +142,7 @@ Preedit_InsertText(preedit_text_t *pText, XIMText *pInsertText, int where)
if (pInsertText->encoding_is_wchar)
{
wchar_t *pWCString = pInsertText->string.wide_char;
- size_t nBytes = wcstombs ( nullptr, pWCString, 1024 /* don't care */);
+ size_t nBytes = wcstombs ( nullptr, pWCString, 0 /* don't care */);
pMBString = static_cast<char*>(alloca( nBytes + 1 ));
nMBLength = wcstombs ( pMBString, pWCString, nBytes + 1);
}
@@ -476,7 +476,7 @@ StatusDrawCallback (XIC, XPointer, XIMStatusDrawCallbackStruct *call_data)
if( call_data->data.text->string.wide_char )
{
wchar_t* pWString = call_data->data.text->string.wide_char;
- size_t nBytes = wcstombs( nullptr, pWString, 1024 );
+ size_t nBytes = wcstombs( nullptr, pWString, 0 /*don't care*/ );
pMBString = static_cast<sal_Char*>(alloca( nBytes+1 ));
nLength = wcstombs( pMBString, pWString, nBytes+1 );
}
commit 8447e1737d42dea2f7955f2c3ee377949f61a79f
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Dec 4 16:51:28 2019 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:03 2021 +0100
Silence -Werror=maybe-uninitialized
...where the members of aRectangle passed into gtv_calc_header_bar_draw_text
(and unconditionally used there, see the definition further up in this file) are
only set for ROW and COLUMN types. Lets assume that no other types can happen
here? (This is part of libreofficekit/Executable_gtktiledviewer.mk, see
libreofficekit/README for how to execute it.)
Change-Id: I487be241e564127183751758710140ab24941f63
Reviewed-on: https://gerrit.libreoffice.org/84424
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
(cherry picked from commit 281f3d5c418e50a2858619633ebca290bd626c03)
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
index 68c3e881caa4..9117cee8f501 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
@@ -9,6 +9,7 @@
#include <gtk/gtk.h>
+#include <cassert>
#include <cmath>
#include <iostream>
@@ -143,6 +144,10 @@ static bool gtv_calc_header_bar_draw_impl(GtkWidget* pWidget, cairo_t* pCairo)
cairo_rectangle(pCairo, aRectangle.x, aRectangle.height, aRectangle.width, 1);
cairo_fill(pCairo);
}
+ else
+ {
+ assert(false); // should never happen
+ }
gtv_calc_header_bar_draw_text(pCairo, aRectangle, rHeader.m_aText);
nPrevious = rHeader.m_nSize;
commit aaaab569f0003e7e0767bdc2fd4139c6d2c02ff9
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Nov 24 13:06:13 2020 +0000
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:03 2021 +0100
ofz#27817 null deref
Change-Id: I16da6f6f78dfd0a4bc17017275a6644d6e4340c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106533
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 48d052a9f1bdbd34e1819b45ab83f51b84911702)
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
index 5daa1310d810..7d96867acb00 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -659,9 +659,8 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
{
SwTextNode const*const pTextNode(
aRegion.End()->nNode.GetNode().GetTextNode());
- assert(pTextNode);
- SwTextField const*const pField(pTextNode->GetFieldTextAttrAt(
- aRegion.End()->nContent.GetIndex() - 1, true));
+ SwTextField const*const pField = pTextNode ? pTextNode->GetFieldTextAttrAt(
+ aRegion.End()->nContent.GetIndex() - 1, true) : nullptr;
if (pField)
{
SwPostItField const*const pPostIt(
commit be51f68335075ac923e94f0094fd404e9016ab17
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Nov 3 16:53:55 2020 +0000
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:03 2021 +0100
ofz#26943 detect if FormatOfJustInsertedApo was deleted
move FrameDeleteWatch for reuse in the doc filter
Change-Id: I6e53549a837968cb738b5188e8670dd3e38a9c0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105264
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 2a7a62c09582ec24247022a94e929610d141a4c9)
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
index e6e0517a0489..5daa1310d810 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -1126,4 +1126,31 @@ void UpdatePageDescs(SwDoc &rDoc, size_t nInPageDescOffset)
rDoc.ChgPageDesc(i, rDoc.GetPageDesc(i));
}
+FrameDeleteWatch::FrameDeleteWatch(SwFrameFormat* pFormat)
+ : m_pFormat(pFormat)
+{
+ if(m_pFormat)
+ StartListening(pFormat->GetNotifier());
+}
+
+void FrameDeleteWatch::Notify(const SfxHint& rHint)
+{
+ bool bDying = false;
+ if (rHint.GetId() == SfxHintId::Dying)
+ bDying = true;
+ else if (auto pDrawFrameFormatHint = dynamic_cast<const sw::DrawFrameFormatHint*>(&rHint))
+ bDying = pDrawFrameFormatHint->m_eId == sw::DrawFrameFormatHintId::DYING;
+ if (bDying)
+ {
+ m_pFormat = nullptr;
+ EndListeningAll();
+ }
+}
+
+FrameDeleteWatch::~FrameDeleteWatch()
+{
+ m_pFormat = nullptr;
+ EndListeningAll();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 0d659d7dfd65..ce689df01b9d 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -4860,41 +4860,6 @@ HTMLTableOptions::HTMLTableOptions( const HTMLOptions& rOptions,
namespace
{
- class FrameDeleteWatch final: public SvtListener
- {
- SwFrameFormat* m_pFormat;
- public:
- FrameDeleteWatch(SwFrameFormat* pFormat)
- : m_pFormat(pFormat)
- {
- if(m_pFormat)
- StartListening(pFormat->GetNotifier());
- }
-
- virtual void Notify(const SfxHint& rHint) override
- {
- if (auto pDrawFrameFormatHint = dynamic_cast<const sw::DrawFrameFormatHint*>(&rHint))
- {
- if (pDrawFrameFormatHint->m_eId == sw::DrawFrameFormatHintId::DYING)
- {
- m_pFormat = nullptr;
- EndListeningAll();
- }
- }
- }
-
- bool WasDeleted() const
- {
- return !m_pFormat;
- }
-
- virtual ~FrameDeleteWatch() override
- {
- m_pFormat = nullptr;
- EndListeningAll();
- }
- };
-
class IndexInRange
{
private:
diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx
index 2f8450556d39..1e6bf6c8a735 100644
--- a/sw/source/filter/inc/fltshell.hxx
+++ b/sw/source/filter/inc/fltshell.hxx
@@ -330,6 +330,28 @@ public:
}
};
+// detect if the SwFrameFormat it is watching was deleted
+class SW_DLLPUBLIC FrameDeleteWatch final: public SvtListener
+{
+ SwFrameFormat* m_pFormat;
+public:
+ FrameDeleteWatch(SwFrameFormat* pFormat);
+
+ virtual void Notify(const SfxHint& rHint) override;
+
+ SwFrameFormat* GetFormat()
+ {
+ return m_pFormat;
+ }
+
+ bool WasDeleted() const
+ {
+ return !m_pFormat;
+ }
+
+ virtual ~FrameDeleteWatch() override;
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 39b75dc8c4a4..2dca982deeff 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2175,7 +2175,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
std::unique_ptr<OutlinerParaObject> pOutliner = ImportAsOutliner( sText, pRes->nCp2OrIdx,
pRes->nCp2OrIdx + pRes->nMemLen, MAN_AND );
- m_pFormatOfJustInsertedApo = nullptr;
+ m_xFormatOfJustInsertedApo.reset();
SwPostItField aPostIt(
static_cast<SwPostItFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Postit)), sAuthor,
sText, sInitials, OUString(), aDate );
@@ -4265,7 +4265,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage,
, m_aParaStyleMapper(rD)
, m_aCharStyleMapper(rD)
, m_pFlyFormatOfJustInsertedGraphic(nullptr)
- , m_pFormatOfJustInsertedApo(nullptr)
, m_pPreviousNumPaM(nullptr)
, m_pPrevNumRule(nullptr)
, m_aTextNodesHavingFirstLineOfstSet()
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 7759951e6805..cf90848fc619 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1199,7 +1199,7 @@ private:
std::unique_ptr<SwMSConvertControls> m_xFormImpl; // implementation of control
SwFlyFrameFormat* m_pFlyFormatOfJustInsertedGraphic;
- SwFrameFormat* m_pFormatOfJustInsertedApo;
+ std::unique_ptr<FrameDeleteWatch> m_xFormatOfJustInsertedApo;
SwPaM* m_pPreviousNumPaM;
const SwNumRule* m_pPrevNumRule;
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index c96f74b28559..4fb74703ee2b 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2403,18 +2403,20 @@ void WW8TabDesc::CreateSwTable()
Set fly anchor to its anchor pos, so that if a table starts immediately
at this position a new node will be inserted before inserting the table.
*/
- if (!bInsNode && m_pIo->m_pFormatOfJustInsertedApo)
+ SwFrameFormat* pFormat = (!bInsNode && m_pIo->m_xFormatOfJustInsertedApo)
+ ? m_pIo->m_xFormatOfJustInsertedApo->GetFormat() : nullptr;
+ if (pFormat)
{
const SwPosition* pAPos =
- m_pIo->m_pFormatOfJustInsertedApo->GetAnchor().GetContentAnchor();
+ pFormat->GetAnchor().GetContentAnchor();
if (pAPos && &pAPos->nNode.GetNode() == &pPoint->nNode.GetNode())
{
bInsNode = true;
bSetMinHeight = true;
- SwFormatSurround aSur(m_pIo->m_pFormatOfJustInsertedApo->GetSurround());
+ SwFormatSurround aSur(pFormat->GetSurround());
aSur.SetAnchorOnly(true);
- m_pIo->m_pFormatOfJustInsertedApo->SetFormatAttr(aSur);
+ pFormat->SetFormatAttr(aSur);
}
}
@@ -2801,7 +2803,7 @@ void WW8TabDesc::FinishSwTable()
}
}
}
- m_pIo->m_pFormatOfJustInsertedApo = nullptr;
+ m_pIo->m_xFormatOfJustInsertedApo.reset();
m_MergeGroups.clear();
}
}
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index be0c2145763a..0c6b89b1bd5a 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2720,7 +2720,7 @@ void SwWW8ImplReader::StopApo()
//#i8062#
if (m_xSFlyPara && m_xSFlyPara->pFlyFormat)
- m_pFormatOfJustInsertedApo = m_xSFlyPara->pFlyFormat;
+ m_xFormatOfJustInsertedApo.reset(new FrameDeleteWatch(m_xSFlyPara->pFlyFormat));
m_xSFlyPara.reset();
m_xWFlyPara.reset();
commit a1f58cfbf85a3303defceb561730a617806fa051
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Oct 27 10:12:37 2020 +0000
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:03 2021 +0100
ofz#26676 null deref
Change-Id: Ic2bd8b49762266ad48263bd68a143b46fb5fd66f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104863
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 9bf58fd45814f10ecf6131aeeec86123a383723f)
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index b4805ae6d9af..6357bcc83862 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -879,7 +879,14 @@ sal_uInt16 LwpTableLayout::ConvertHeadingRow(
XFRow* pXFRow = pTmpTable->GetRow(1);
pXFTable->AddHeaderRow(pXFRow);
pTmpTable->RemoveRow(1);
- nContentRow = m_RowsMap[0]->GetCurMaxSpannedRows(0,nCol);
+ auto iter = m_RowsMap.find(0);
+ if (iter == m_RowsMap.end())
+ {
+ SAL_WARN("lwp", "row 0 is unknown");
+ nContentRow = 0;
+ }
+ else
+ nContentRow = iter->second->GetCurMaxSpannedRows(0,nCol);
}
}
return nContentRow;
commit 4697b4e42a656d72635dcce0fb31240cfbecc341
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Oct 26 20:38:03 2020 +0000
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:02 2021 +0100
ofz#26619 detect if SwFrameFormat deleted during import
Change-Id: I5dc778e44dcb670353e83037a5a5d469fa437186
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104853
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 7ae9e8b6ba35dec2c556f6fac4034cd9bb1111a1)
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 488edb6dce06..a390ffc0368e 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -284,7 +284,7 @@ void SwHTMLParser::RegisterFlyFrame( SwFrameFormat *pFlyFormat )
(RndStdIds::FLY_AT_PARA == pFlyFormat->GetAnchor().GetAnchorId()) &&
css::text::WrapTextMode_THROUGH == pFlyFormat->GetSurround().GetSurround() )
{
- m_aMoveFlyFrames.push_back( pFlyFormat );
+ m_aMoveFlyFrames.emplace_back(std::make_unique<SwHTMLFrameFormatListener>(pFlyFormat));
m_aMoveFlyCnts.push_back( m_pPam->GetPoint()->nContent.GetIndex() );
}
}
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index aaa6c2e7dd35..3f72a8a044e3 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2679,6 +2679,18 @@ SwViewShell *SwHTMLParser::CheckActionViewShell()
return m_pActionViewShell;
}
+SwHTMLFrameFormatListener::SwHTMLFrameFormatListener(SwFrameFormat* pFrameFormat)
+ : m_pFrameFormat(pFrameFormat)
+{
+ StartListening(m_pFrameFormat->GetNotifier());
+}
+
+void SwHTMLFrameFormatListener::Notify(const SfxHint& rHint)
+{
+ if (rHint.GetId() == SfxHintId::Dying)
+ m_pFrameFormat = nullptr;
+}
+
void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable,
std::deque<std::unique_ptr<HTMLAttr>> *pPostIts )
{
@@ -2938,7 +2950,14 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable,
for( auto n = m_aMoveFlyFrames.size(); n; )
{
- SwFrameFormat *pFrameFormat = m_aMoveFlyFrames[ --n ];
+ SwFrameFormat *pFrameFormat = m_aMoveFlyFrames[--n]->GetFrameFormat();
+ if (!pFrameFormat)
+ {
+ SAL_WARN("sw.html", "SwFrameFormat deleted during import");
+ m_aMoveFlyFrames.erase( m_aMoveFlyFrames.begin() + n );
+ m_aMoveFlyCnts.erase( m_aMoveFlyCnts.begin() + n );
+ continue;
+ }
const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor();
OSL_ENSURE( RndStdIds::FLY_AT_PARA == rAnchor.GetAnchorId(),
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 64872e684a92..e0537d5e7880 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -330,6 +330,15 @@ namespace o3tl
template<> struct typed_flags<HtmlFrameFormatFlags> : is_typed_flags<HtmlFrameFormatFlags, 0x0f> {};
}
+class SwHTMLFrameFormatListener : public SvtListener
+{
+ SwFrameFormat* m_pFrameFormat;
+public:
+ SwHTMLFrameFormatListener(SwFrameFormat* pFrameFormat);
+ SwFrameFormat* GetFrameFormat() { return m_pFrameFormat; }
+ virtual void Notify(const SfxHint&) override;
+};
+
class SwHTMLParser : public SfxHTMLParser, public SvtListener
{
friend class SectionSaveStruct;
@@ -365,7 +374,7 @@ class SwHTMLParser : public SfxHTMLParser, public SvtListener
HTMLAttrs m_aParaAttrs; // temporary paragraph attributes
std::shared_ptr<HTMLAttrTable> m_xAttrTab; // "open" attributes
HTMLAttrContexts m_aContexts;// the current context of attribute/token
- std::vector<SwFrameFormat *> m_aMoveFlyFrames;// Fly-Frames, the anchor is moved
+ std::vector<std::unique_ptr<SwHTMLFrameFormatListener>> m_aMoveFlyFrames;// Fly-Frames, the anchor is moved
std::deque<sal_Int32> m_aMoveFlyCnts;// and the Content-Positions
//stray SwTableBoxes which need to be deleted to avoid leaking, but hold
//onto them until parsing is done
commit aa3b1829aef191ef6f7e16f9c6e5d15cd3da583a
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Oct 18 20:36:16 2020 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:02 2021 +0100
ofz#26480 validate WW8PLCFpcd is sorted like WW8PLCF does
Change-Id: I11393c730986585aeea229ebeec6417e4a0578d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104510
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 7f55db80c6fe42c162bbf51404e638a66b6ae9ab)
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 35fa751c37f0..b52469f08208 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2334,26 +2334,40 @@ void WW8PLCF::ReadPLCF(SvStream& rSt, WW8_FC nFilePos, sal_uInt32 nPLCF)
void WW8PLCF::MakeFailedPLCF()
{
nIMax = 0;
- pPLCF_PosArray.reset( new sal_Int32[2] );
+ pPLCF_PosArray.reset( new WW8_CP[2] );
pPLCF_PosArray[0] = pPLCF_PosArray[1] = WW8_CP_MAX;
pPLCF_Contents = reinterpret_cast<sal_uInt8*>(&pPLCF_PosArray[nIMax + 1]);
}
-void WW8PLCF::TruncToSortedRange()
+namespace
{
- //Docs state that: ... all Plcs ... are sorted in ascending order.
- //So ensure that here for broken documents.
- for (auto nI = 0; nI < nIMax; ++nI)
+ sal_Int32 TruncToSortedRange(const sal_Int32* pPLCF_PosArray, sal_Int32 nIMax)
{
- if (pPLCF_PosArray[nI] > pPLCF_PosArray[nI+1])
+ //Docs state that: ... all Plcs ... are sorted in ascending order.
+ //So ensure that here for broken documents.
+ for (auto nI = 0; nI < nIMax; ++nI)
{
- SAL_WARN("sw.ww8", "Document has unsorted PLCF, truncated to sorted portion");
- nIMax = nI;
- break;
+ if (pPLCF_PosArray[nI] > pPLCF_PosArray[nI+1])
+ {
+ SAL_WARN("sw.ww8", "Document has unsorted PLCF, truncated to sorted portion");
+ nIMax = nI;
+ break;
+ }
}
+ return nIMax;
}
}
+void WW8PLCFpcd::TruncToSortedRange()
+{
+ nIMax = ::TruncToSortedRange(pPLCF_PosArray.get(), nIMax);
+}
+
+void WW8PLCF::TruncToSortedRange()
+{
+ nIMax = ::TruncToSortedRange(pPLCF_PosArray.get(), nIMax);
+}
+
void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN)
{
OSL_ENSURE( nIMax < ncpN, "Pcl.Fkp: Why is PLCF too big?" );
@@ -2375,7 +2389,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN)
{
size_t nSiz = (4 + nStru) * nIMax + 4;
size_t nElems = ( nSiz + 3 ) / 4;
- pPLCF_PosArray.reset( new sal_Int32[ nElems ] ); // Pointer to Pos-array
+ pPLCF_PosArray.reset( new WW8_CP[ nElems ] ); // Pointer to Pos-array
for (sal_Int32 i = 0; i < ncpN && !failure; ++i)
{
@@ -2509,7 +2523,7 @@ WW8PLCFpcd::WW8PLCFpcd(SvStream* pSt, sal_uInt32 nFilePos,
bValid = false;
nPLCF = bValid ? std::min(nRemainingSize, static_cast<std::size_t>(nPLCF)) : nValidMin;
- pPLCF_PosArray.reset( new sal_Int32[ ( nPLCF + 3 ) / 4 ] ); // Pointer to Pos-array
+ pPLCF_PosArray.reset( new WW8_CP[ ( nPLCF + 3 ) / 4 ] ); // Pointer to Pos-array
pPLCF_PosArray[0] = 0;
nPLCF = bValid ? pSt->ReadBytes(pPLCF_PosArray.get(), nPLCF) : nValidMin;
@@ -2523,6 +2537,7 @@ WW8PLCFpcd::WW8PLCFpcd(SvStream* pSt, sal_uInt32 nFilePos,
// Pointer to content array
pPLCF_Contents = reinterpret_cast<sal_uInt8*>(&pPLCF_PosArray[nIMax + 1]);
+ TruncToSortedRange();
pSt->Seek( nOldPos );
}
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 1a5b024c12fb..6d01af87316e 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -339,14 +339,16 @@ class WW8PLCFpcd
{
friend class WW8PLCFpcd_Iter;
- std::unique_ptr<sal_Int32[]> pPLCF_PosArray; // pointer to Pos-array and the whole structure
+ std::unique_ptr<WW8_CP[]> pPLCF_PosArray; // pointer to Pos-array and the whole structure
sal_uInt8* pPLCF_Contents; // pointer to content-array-part of Pos-array
- long nIMax;
+ sal_Int32 nIMax;
sal_uInt32 nStru;
WW8PLCFpcd(const WW8PLCFpcd&) = delete;
WW8PLCFpcd& operator=(const WW8PLCFpcd&) = delete;
+ void TruncToSortedRange();
+
public:
WW8PLCFpcd(SvStream* pSt, sal_uInt32 nFilePos, sal_uInt32 nPLCF,
sal_uInt32 nStruct);
commit 1798c8620bbf3c104cf065b097fbcd87c264ccdd
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Oct 3 21:56:19 2020 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:02 2021 +0100
ofz#26122 allow NINSIZE input full elements
Change-Id: Ifbde8fc055a91e23db08508a34ce4664d2f1f96f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103906
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit fb0c3f9d8964f8c0f40238559c32d9d73cba6b55)
diff --git a/vcl/source/font/fontcharmap.cxx b/vcl/source/font/fontcharmap.cxx
index 17f9065261ab..11a6a366e208 100644
--- a/vcl/source/font/fontcharmap.cxx
+++ b/vcl/source/font/fontcharmap.cxx
@@ -333,7 +333,8 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
static const int NINSIZE = 64;
static const int NOUTSIZE = 64;
- sal_Char cCharsInp[ NINSIZE ];
+ std::vector<char> cCharsInp;
+ cCharsInp.reserve(NINSIZE);
sal_Unicode cCharsOut[ NOUTSIZE ];
sal_UCS4* pCP = pCodePairs;
for( int i = 0; i < nRangeCount; ++i )
@@ -344,25 +345,26 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
// input codepoints in 0..SAL_MAX_UINT16 range
while (cMin < cEnd && cMin <= SAL_MAX_UINT16)
{
- int j = 0;
- for(; (cMin < cEnd) && (j < NINSIZE); ++cMin )
+ for (int j = 0; (cMin < cEnd) && (j < NINSIZE); ++cMin, ++j)
{
if( cMin >= 0x0100 )
- cCharsInp[ j++ ] = static_cast<sal_Char>(cMin >> 8);
+ cCharsInp.push_back(static_cast<char>(cMin >> 8));
if( (cMin >= 0x0100) || (cMin < 0x00A0) )
- cCharsInp[ j++ ] = static_cast<sal_Char>(cMin);
+ cCharsInp.push_back(static_cast<char>(cMin));
}
sal_uInt32 nCvtInfo;
sal_Size nSrcCvtBytes;
int nOutLen = rtl_convertTextToUnicode(
aConverter, aCvtContext,
- cCharsInp, j, cCharsOut, NOUTSIZE,
+ cCharsInp.data(), cCharsInp.size(), cCharsOut, NOUTSIZE,
RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE
| RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE,
&nCvtInfo, &nSrcCvtBytes );
- for( j = 0; j < nOutLen; ++j )
+ cCharsInp.clear();
+
+ for (int j = 0; j < nOutLen; ++j)
aSupportedCodePoints.insert( cCharsOut[j] );
}
}
commit 6b967e97cfe9bb65307f31e3bc9c51b05ad35db3
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 29 20:59:40 2020 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:02 2021 +0100
ofz#25989 cmap parsing
Change-Id: I048e5d88d5926a4afa75afab18db5ca6354e2454
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103641
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 9a1202edab0cfe95572f12a8c49ef756ead49bf2)
diff --git a/vcl/source/font/fontcharmap.cxx b/vcl/source/font/fontcharmap.cxx
index 92760875b647..17f9065261ab 100644
--- a/vcl/source/font/fontcharmap.cxx
+++ b/vcl/source/font/fontcharmap.cxx
@@ -229,7 +229,7 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
// update the glyphid-array with the glyphs in this range
pStartGlyphs[i] = -static_cast<int>(aGlyphIdArray.size());
const unsigned char* pGlyphIdPtr = pOffsetBase + 2*i + nRangeOffset;
- const size_t nRemainingSize = pEndValidArea - pGlyphIdPtr;
+ const size_t nRemainingSize = pEndValidArea >= pGlyphIdPtr ? pEndValidArea - pGlyphIdPtr : 0;
const size_t nMaxPossibleRecords = nRemainingSize/2;
if (nMaxPossibleRecords == 0) { // no sane font should trigger this
SAL_WARN("vcl.gdi", "More indexes claimed that space available in font!");
commit 8a14691232de793d730cdd44b1fe68fc22d508ad
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Mar 7 19:24:42 2020 +0000
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:02 2021 +0100
ofz#20622 oom
Change-Id: Id77d90197e98d29787a40966f248dd769c9dac28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90175
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 1e95c2c17a49349caba1e62b4de3752c5f767f01)
diff --git a/include/vcl/BitmapTools.hxx b/include/vcl/BitmapTools.hxx
index 1cf13d4c7de8..3652bb849bf4 100644
--- a/include/vcl/BitmapTools.hxx
+++ b/include/vcl/BitmapTools.hxx
@@ -53,7 +53,8 @@ public:
assert(nBitCount == 24 || nBitCount == 32);
sal_Int32 nRowSize, nDataSize;
if (o3tl::checked_multiply<sal_Int32>(rSize.getWidth(), nBitCount/8, nRowSize) ||
- o3tl::checked_multiply<sal_Int32>(nRowSize, rSize.getHeight(), nDataSize))
+ o3tl::checked_multiply<sal_Int32>(nRowSize, rSize.getHeight(), nDataSize) ||
+ nDataSize < 0)
{
throw std::bad_alloc();
}
commit 9c66391f353f4b78bdf8a3ddd8e7e615d9341ddf
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Feb 7 14:09:57 2020 +0000
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:02 2021 +0100
ofz#20517 null-dereference
Change-Id: I443869f848925911ed46e2f547f0dc652b1ff290
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88214
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 08695569fd4fccc1722e7e3c7e0a234699199196)
diff --git a/lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp b/lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp
new file mode 100644
index 000000000000..de6dcbf1c5d5
Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp differ
diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx
index d958486e3553..98acf39085d4 100644
--- a/lotuswordpro/source/filter/lwprowlayout.cxx
+++ b/lotuswordpro/source/filter/lwprowlayout.cxx
@@ -379,11 +379,13 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa
LwpTableLayout* pTableLayout = GetParentTableLayout();
if (!pTableLayout)
return;
+ LwpTable* pTable = pTableLayout->GetTable();
+ if (!pTable)
+ return;
rtl::Reference<XFRow> xRow(new XFRow);
xRow->SetStyleName(m_StyleName);
- LwpTable* pTable = pTableLayout->GetTable();
sal_uInt8 nCellStartCol,nCellEndCol;
for (sal_uInt8 i = nStartCol; i < nEndCol ; i++)
commit fcf2c95fd9fd8e9cffd77989fcefa6d82b075ec4
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Feb 1 11:21:10 2020 +0000
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:02 2021 +0100
ofz#20447 Null-dereference READ
Change-Id: I76c1c815ab5aaf4548c886a69989fcabe3de5248
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87802
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit fec7e3422f4d1c5b9382518a11d0bb99b12e41c9)
diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx
index 10eed55d0499..d958486e3553 100644
--- a/lotuswordpro/source/filter/lwprowlayout.cxx
+++ b/lotuswordpro/source/filter/lwprowlayout.cxx
@@ -191,7 +191,8 @@ void LwpRowLayout::Read()
void LwpRowLayout::ConvertRow(rtl::Reference<XFTable> const & pXFTable,sal_uInt8 nStartCol,sal_uInt8 nEndCol)
{
LwpTableLayout* pTableLayout = GetParentTableLayout();
- assert(pTableLayout);
+ if (!pTableLayout)
+ throw std::runtime_error("missing TableLayout");
LwpTable* pTable = pTableLayout->GetTable();
//calculate the connected cell position
commit 50d49fc21ad804ff6842f065e146ed6f66f42a19
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jan 28 16:43:28 2020 +0000
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:02 2021 +0100
ofz#20366 OOM
Change-Id: If658720502739e6ad88c3cf73ac6674e0313a48b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87648
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 090cf1e3bbe0ffaf56f22b152b73578483be2f42)
diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx
index 825c90243e0a..025ab1fc588a 100644
--- a/filter/source/graphicfilter/icgm/bitmap.cxx
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -316,7 +316,15 @@ bool CGMBitmap::ImplGetDimensions( CGMBitmapDescriptor& rDesc )
rDesc.mbStatus = false;
sal_uInt32 nHeaderSize = 2 + 3 * nPrecision + 3 * mpCGM->ImplGetPointSize();
- rDesc.mnScanSize = ( ( rDesc.mnX * rDesc.mnDstBitsPerPixel + 7 ) >> 3 );
+
+ sal_uInt32 nWidthBits;
+ if (o3tl::checked_multiply(rDesc.mnX, rDesc.mnDstBitsPerPixel, nWidthBits))
+ {
+ rDesc.mbStatus = false;
+ return false;
+ }
+
+ rDesc.mnScanSize = (nWidthBits + 7) >> 3;
sal_uInt32 nScanSize;
nScanSize = rDesc.mnScanSize;
commit f17c111fd829eae88577d680d150b36d9d15902a
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Feb 1 12:04:26 2020 +0000
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 22:34:02 2021 +0100
ofz#20456 Null-dereference READ
this is the first honggfuzz (honggfuzz_asan_libreoffice) report I've seen to date
Change-Id: Iac733aa63c7c94d9454b9c8596340dc2286393c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87803
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 0754e581b0d8569dd08cf26f88678754f249face)
diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx
index 287f8de65434..10eed55d0499 100644
--- a/lotuswordpro/source/filter/lwprowlayout.cxx
+++ b/lotuswordpro/source/filter/lwprowlayout.cxx
@@ -282,14 +282,15 @@ void LwpRowLayout::RegisterCurRowStyle(XFRow* pXFRow,sal_uInt16 nRowMark)
{
pRowStyle = static_cast<XFRowStyle*>(
pXFStyleManager->FindStyle(pTableLayout->GetDefaultRowStyleName()));
- fHeight += pRowStyle->GetRowHeight();
}
else
{
pRowStyle = static_cast<XFRowStyle*>(
pXFStyleManager->FindStyle(iter->second->GetStyleName()));
- fHeight+=pRowStyle->GetRowHeight();
}
+ if (!pRowStyle)
+ throw std::runtime_error("missing RowStyle");
+ fHeight += pRowStyle->GetRowHeight();
}
if (m_nDirection & 0x0030)
More information about the Libreoffice-commits
mailing list