[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 10 commits - basic/qa basic/source download.lst emfio/qa emfio/source external/libxml2 extras/source oox/qa oox/source sc/source svtools/source sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed May 26 09:50:23 UTC 2021


 basic/qa/basic_coverage/test_string_literal_comparison.vb |   19 +++++
 basic/source/comp/exprnode.cxx                            |    8 +-
 download.lst                                              |    4 -
 emfio/qa/cppunit/emf/EmfImportTest.cxx                    |   29 ++++++-
 emfio/qa/cppunit/wmf/data/TestRoundRect.wmf               |binary
 emfio/source/reader/mtftools.cxx                          |    1 
 external/libxml2/UnpackedTarball_libxml2.mk               |    1 
 external/libxml2/libxml2-config.patch.1                   |    4 -
 external/libxml2/libxml2-global-symbols.patch             |    4 -
 external/libxml2/ubsan.patch.0                            |   11 --
 extras/source/autocorr/lang/ja/DocumentList.xml           |    7 -
 oox/qa/unit/data/tdf137314_vml_rotation_unit_fd.docx      |binary
 oox/qa/unit/vml.cxx                                       |   23 ++++++
 oox/source/vml/vmlshape.cxx                               |    7 -
 sc/source/ui/docshell/impex.cxx                           |    4 -
 sc/source/ui/inc/viewdata.hxx                             |   10 ++
 sc/source/ui/view/cellsh.cxx                              |   14 ++-
 sc/source/ui/view/viewdata.cxx                            |   52 ++++++++++++++
 sc/source/ui/view/viewfun3.cxx                            |    2 
 svtools/source/control/valueset.cxx                       |    8 ++
 sw/source/core/text/frmform.cxx                           |   10 ++
 sw/source/uibase/dbui/dbtree.cxx                          |    2 
 22 files changed, 171 insertions(+), 49 deletions(-)

New commits:
commit 5ce3a46d52796336a6deebf01b8403a1ce8b3065
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 25 13:24:29 2021 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed May 26 11:49:49 2021 +0200

    tdf#142479 on 'return' select the entry the cursor is in before calling Select
    
    Change-Id: Ic11f8a12c93d1999dd6fbe555b9823660eb703d0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115968
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index f71b18bfd77e..a83888276b31 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -425,6 +425,14 @@ bool ValueSet::KeyInput( const KeyEvent& rKeyEvent )
         case KEY_RETURN:
             if (GetStyle() & WB_NO_DIRECTSELECT)
             {
+                // tdf#142479 on return select the entry the cursor is in
+                // before calling Select
+                if (nCurPos != VALUESET_ITEM_NONEITEM)
+                {
+                    const sal_uInt16 nItemId = GetItemId(nCurPos);
+                    if (nItemId != mnSelItemId)
+                        SelectItem(nItemId);
+                }
                 Select();
                 break;
             }
commit 1ba5e5d4b2eee5c2c05606e86878aaa07f7f698a
Author:     Regina Henschel <rb.henschel at t-online.de>
AuthorDate: Mon May 24 23:25:58 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed May 26 11:49:49 2021 +0200

    tdf#137314 apply conversion from vml angle unit 'fd'
    
    Fixes wrong rotation in tdf#109129 and tdf#142432 too, but they have
    further, unrelated errors.
    
    Change-Id: I7bd56876bb42b261fe425f80cf9beb639c3ac276
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116078
    Tested-by: Jenkins
    Reviewed-by: Regina Henschel <rb.henschel at t-online.de>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116094

diff --git a/oox/qa/unit/data/tdf137314_vml_rotation_unit_fd.docx b/oox/qa/unit/data/tdf137314_vml_rotation_unit_fd.docx
new file mode 100644
index 000000000000..17c8cabc0ce9
Binary files /dev/null and b/oox/qa/unit/data/tdf137314_vml_rotation_unit_fd.docx differ
diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx
index ec64a08c3fcf..94e73459d995 100644
--- a/oox/qa/unit/vml.cxx
+++ b/oox/qa/unit/vml.cxx
@@ -12,6 +12,7 @@
 
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
 #include <com/sun/star/frame/Desktop.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
@@ -55,6 +56,28 @@ void OoxVmlTest::load(const OUString& rFileName)
     mxComponent = loadFromDesktop(aURL);
 }
 
+CPPUNIT_TEST_FIXTURE(OoxVmlTest, tdf137314_vml_rotation_unit_fd)
+{
+    // Load a document with a 30deg rotated arc on a drawing canvas. Rotation is given
+    // as 1966080fd. Error was, that the vml angle unit "fd" was not converted to Degree100.
+    load(u"tdf137314_vml_rotation_unit_fd.docx");
+    uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+                                                 uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xGroup(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+    uno::Reference<drawing::XShape> xShape(xGroup->getByIndex(1), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
+    drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords;
+    xShapeProps->getPropertyValue("PolyPolygonBezier") >>= aPolyPolygonBezierCoords;
+    drawing::PointSequence aPolygon = aPolyPolygonBezierCoords.Coordinates[1];
+    // Without fix in place, the vector was -1441|1490.
+    // [1] and [2] are Bezier-curve control points.
+    sal_Int32 nDiffX = aPolygon[3].X - aPolygon[0].X;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1490), nDiffX);
+    sal_Int32 nDiffY = aPolygon[3].Y - aPolygon[0].Y;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1441), nDiffY);
+}
+
 CPPUNIT_TEST_FIXTURE(OoxVmlTest, testSpt202ShapeType)
 {
     // Load a document with a groupshape, 2nd child is a <v:shape>, its type has o:spt set to 202
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 5bceff932a24..4ce5ffb30a34 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1079,10 +1079,9 @@ namespace
         {
             if (SdrObject* pShape = GetSdrObjectFromXShape(rxShape))
             {
-                // -1 is required because the direction of MSO rotation is the opposite of ours
-                // 100 is required because in this part of the code the angle is in a hundredth of
-                // degrees.
-                auto nAngle = -1 * 100.0 * rTypeModel.maRotation.toDouble();
+                // The needed factor -1 for opposite direction and factor 100 for Degree100 is
+                // contained in method decodeRotation().
+                auto nAngle(ConversionHelper::decodeRotation(rTypeModel.maRotation));
                 double nHRad = nAngle * F_PI18000;
                 pShape->NbcRotate(pShape->GetSnapRect().Center(), nAngle, sin(nHRad), cos(nHRad));
             }
commit 959f7bf65359583e6ab40877c8b9a7f25effce11
Author:     Jun NOGATA <nogajun at gmail.com>
AuthorDate: Sun May 23 13:54:40 2021 +0900
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed May 26 11:49:49 2021 +0200

    Removed 1/2, 1/4, 3/4, and 0.5 from autocorr/lang/ja/DocumentList.xml
    
      Reason
      * The character such as a ½ are not used in Japan
         * Many people complained that the date is converted by itself
           http://www.fujisekkei.sakura.ne.jp/ooo/?p=435
         * In a survey, many people said they wanted it removed
           https://twitter.com/LibreOffice_Ja/status/1345602562678931457
      * Can be substituted by typing :1/2:
    
    Change-Id: Ifab7fcc9f164f1db2c3546eaf8e9ae40271c0455
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116011
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
    (cherry picked from commit 02181b90af46a4736502318a36a5ca8630de09a1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115966

diff --git a/extras/source/autocorr/lang/ja/DocumentList.xml b/extras/source/autocorr/lang/ja/DocumentList.xml
index ec23310feb8e..7718aaa5e36e 100644
--- a/extras/source/autocorr/lang/ja/DocumentList.xml
+++ b/extras/source/autocorr/lang/ja/DocumentList.xml
@@ -1,11 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <block-list:block-list xmlns:block-list="http://openoffice.org/2001/block-list">
-  <block-list:block block-list:abbreviated-name=".5" block-list:name="½"/>
   <block-list:block block-list:abbreviated-name=".*(C)" block-list:name="©"/>
   <block-list:block block-list:abbreviated-name=".*(R)" block-list:name="®"/>
-  <block-list:block block-list:abbreviated-name="1/2" block-list:name="½"/>
-  <block-list:block block-list:abbreviated-name="1/4" block-list:name="¼"/>
-  <block-list:block block-list:abbreviated-name="3/4" block-list:name="¾"/>
   <block-list:block block-list:abbreviated-name="abbout" block-list:name="about"/>
   <block-list:block block-list:abbreviated-name="abotu" block-list:name="about"/>
   <block-list:block block-list:abbreviated-name="abouta" block-list:name="about a"/>
@@ -811,9 +807,6 @@
   <block-list:block block-list:abbreviated-name="ytou" block-list:name="you"/>
   <block-list:block block-list:abbreviated-name="yuo" block-list:name="you"/>
   <block-list:block block-list:abbreviated-name="yuor" block-list:name="your"/>
-  <block-list:block block-list:abbreviated-name="1/2" block-list:name="½"/>
-  <block-list:block block-list:abbreviated-name="1/4" block-list:name="¼"/>
-  <block-list:block block-list:abbreviated-name="3/4" block-list:name="¾"/>
   <block-list:block block-list:abbreviated-name=":^0:" block-list:name="⁰"/>
   <block-list:block block-list:abbreviated-name=":_0:" block-list:name="₀"/>
   <block-list:block block-list:abbreviated-name=":100:" block-list:name="💯"/>
commit 67029c1997a53a21ec3ef0b41bbc50ea2406cabd
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Mon May 24 01:29:19 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed May 26 11:49:49 2021 +0200

    Resolves: tdf#134675 Allow unrestricted pastes of same size in one dimension
    
    So copy-paste of for example one entire column onto more than 23
    columns is possible as that does not create multiple repetitions.
    
    Change-Id: I2b035afa1c04522db55569396a36b1bac57c590c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116031
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116039

diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 4026c175e13e..6e11410272bd 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -480,7 +480,15 @@ public:
 
     bool            IsMultiMarked() const;
 
-                    /** Disallow cell fill (Paste,Fill,...) on Ctrl+A all
+                    /** Disallow Paste on Ctrl+A all selected or another high
+                        amount of selected cells that is not the same size in
+                        one direction as the clipboard source.
+                        To prevent DOOM.
+                     */
+    bool            SelectionForbidsPaste( ScDocument* pClipDoc = nullptr );
+    bool            SelectionForbidsPaste( SCCOL nSrcCols, SCROW nSrcRows );
+
+                    /** Disallow cell fill (Fill,Enter,...) on Ctrl+A all
                         selected or another high amount of selected cells.
                         We'd go DOOM.
                      */
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index cd46db595914..fc24d18a56be 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -223,7 +223,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
             case SID_PASTE_ONLY_TEXT:
             case SID_PASTE_ONLY_FORMULA:
             case SID_PASTE_TEXTIMPORT_DIALOG:
-                bDisable = GetViewData()->SelectionForbidsCellFill();
+                bDisable = GetViewData()->SelectionForbidsPaste();
                 break;
 
             case FID_INS_ROW:
@@ -543,12 +543,11 @@ bool checkDestRanges(ScViewData& rViewData)
             return false;
     }
 
-    if (rViewData.SelectionForbidsCellFill())
-        return false;
-
     // Multiple destination ranges.
 
-    ScDocument& rDoc = rViewData.GetDocument();
+    // Same as ScViewData::SelectionForbidsPaste() in
+    // sc/source/ui/view/viewdata.cxx but different return details.
+
     vcl::Window* pWin = rViewData.GetActiveWin();
     if (!pWin)
         return false;
@@ -566,12 +565,15 @@ bool checkDestRanges(ScViewData& rViewData)
     SCROW nRowSize = aSrcRange.aEnd.Row() - aSrcRange.aStart.Row() + 1;
     SCCOL nColSize = aSrcRange.aEnd.Col() - aSrcRange.aStart.Col() + 1;
 
+    if (rViewData.SelectionForbidsPaste( nColSize, nRowSize))
+        return false;
+
     ScMarkData aMark = rViewData.GetMarkData();
     ScRangeList aRanges;
     aMark.MarkToSimple();
     aMark.FillRangeListWithMarks(&aRanges, false);
 
-    return ScClipUtil::CheckDestRanges(rDoc, nColSize, nRowSize, aMark, aRanges);
+    return ScClipUtil::CheckDestRanges(rViewData.GetDocument(), nColSize, nRowSize, aMark, aRanges);
 }
 
 }
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 91f5fc6062af..f0f3d25e0e2f 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -55,6 +55,8 @@
 #include <markdata.hxx>
 #include <ViewSettingsSequenceDefines.hxx>
 #include <gridwin.hxx>
+#include <transobj.hxx>
+#include <clipparam.hxx>
 #include <comphelper/flagguard.hxx>
 #include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
@@ -1255,6 +1257,56 @@ bool ScViewData::IsMultiMarked() const
     return (eType & SC_MARK_SIMPLE) != SC_MARK_SIMPLE;
 }
 
+bool ScViewData::SelectionForbidsPaste( ScDocument* pClipDoc )
+{
+    if (!pClipDoc)
+    {
+        // Same as checkDestRanges() in sc/source/ui/view/cellsh.cxx but
+        // different return details.
+
+        vcl::Window* pWin = GetActiveWin();
+        if (!pWin)
+            // No window doesn't mean paste would be forbidden.
+            return false;
+
+        const ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(pWin));
+        if (!pOwnClip)
+            // Foreign content does not get repeatedly replicated.
+            return false;
+
+        pClipDoc = pOwnClip->GetDocument();
+        if (!pClipDoc)
+            // No clipdoc doesn't mean paste would be forbidden.
+            return false;
+    }
+
+    const ScRange aSrcRange = pClipDoc->GetClipParam().getWholeRange();
+    const SCROW nRowSize = aSrcRange.aEnd.Row() - aSrcRange.aStart.Row() + 1;
+    const SCCOL nColSize = aSrcRange.aEnd.Col() - aSrcRange.aStart.Col() + 1;
+
+    return SelectionForbidsPaste( nColSize, nRowSize);
+}
+
+bool ScViewData::SelectionForbidsPaste( SCCOL nSrcCols, SCROW nSrcRows )
+{
+    ScRange aSelRange( ScAddress::UNINITIALIZED );
+    ScMarkType eMarkType = GetSimpleArea( aSelRange);
+
+    if (eMarkType == SC_MARK_MULTI)
+        // Not because of DOOM.
+        return false;
+
+    if (aSelRange.aEnd.Row() - aSelRange.aStart.Row() + 1 == nSrcRows)
+        // This also covers entire col(s) copied to be pasted on entire cols.
+        return false;
+
+    if (aSelRange.aEnd.Col() - aSelRange.aStart.Col() + 1 == nSrcCols)
+        // This also covers entire row(s) copied to be pasted on entire rows.
+        return false;
+
+    return SelectionFillDOOM( aSelRange);
+}
+
 bool ScViewData::SelectionForbidsCellFill()
 {
     ScRange aSelRange( ScAddress::UNINITIALIZED );
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 8504cdd1fb22..02d87d5bf503 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -884,7 +884,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
         return false;
     }
 
-    if (GetViewData().SelectionForbidsCellFill())
+    if (GetViewData().SelectionForbidsPaste(pClipDoc))
         return false;
 
     //  undo: save all or no content
commit 10f174433ca9a62e82b396fb1650d01372f699e7
Author:     Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Fri May 21 13:33:26 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed May 26 11:49:49 2021 +0200

    libxml2: upgrade to release 2.9.12
    
    Fixes:
    CVE-2021-3516 CVE-2021-3517 CVE-2021-3518 CVE-2021-3537 CVE-2021-3541
    
    * external/libxml2/ubsan.patch.0: remove, fixed upstream
    
    Change-Id: I347dc854b862e78bde87d3e57cf5fdb584ca5673
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115913
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
    (cherry picked from commit bf0c6a98ae38cd2188d7f7e94f1563e5ce6a8ce4)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115925
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/download.lst b/download.lst
index f16533053461..73b417ab57d5 100644
--- a/download.lst
+++ b/download.lst
@@ -190,8 +190,8 @@ export LIBTOMMATH_SHA256SUM := 083daa92d8ee6f4af96a6143b12d7fc8fe1a547e14f862304
 export LIBTOMMATH_TARBALL := ltm-1.0.zip
 export XMLSEC_SHA256SUM := 2d84360b03042178def1d9ff538acacaed2b3a27411db7b2874f1612ed71abc8
 export XMLSEC_TARBALL := xmlsec1-1.2.30.tar.gz
-export LIBXML_SHA256SUM := aafee193ffb8fe0c82d4afef6ef91972cbaf5feea100edc2f262750611b4be1f
-export LIBXML_VERSION_MICRO := 10
+export LIBXML_SHA256SUM := c8d6681e38c56f172892c85ddc0852e1fd4b53b4209e7f4ebf17f7e2eae71d92
+export LIBXML_VERSION_MICRO := 12
 export LIBXML_TARBALL := libxml2-2.9.$(LIBXML_VERSION_MICRO).tar.gz
 export LIBXSLT_SHA256SUM := 98b1bd46d6792925ad2dfe9a87452ea2adebf69dcb9919ffd55bf926a7f93f7f
 export LIBXSLT_VERSION_MICRO := 34
diff --git a/external/libxml2/UnpackedTarball_libxml2.mk b/external/libxml2/UnpackedTarball_libxml2.mk
index 37b5bad97549..83df02849cb3 100644
--- a/external/libxml2/UnpackedTarball_libxml2.mk
+++ b/external/libxml2/UnpackedTarball_libxml2.mk
@@ -21,7 +21,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,libxml2,\
 	$(if $(gb_Module_CURRENTMODULE_SYMBOLS_ENABLED), \
 		external/libxml2/libxml2-icu-sym.patch.0, \
 		external/libxml2/libxml2-icu.patch.0) \
-	external/libxml2/ubsan.patch.0 \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/libxml2/libxml2-config.patch.1 b/external/libxml2/libxml2-config.patch.1
index 8c28fb6a7806..5a2ef1485e92 100644
--- a/external/libxml2/libxml2-config.patch.1
+++ b/external/libxml2/libxml2-config.patch.1
@@ -18,9 +18,9 @@ Hack the xml2-config to return paths into WORKDIR.
 +exec_prefix=${WORKDIR}/UnpackedTarball/libxml2
 +includedir=${WORKDIR}/UnpackedTarball/libxml2/include
 +libdir=${WORKDIR}/UnpackedTarball/libxml2/.libs
+ cflags=
+ libs=
  
- usage()
- {
 @@ -67,7 +72,8 @@
  	;;
  
diff --git a/external/libxml2/libxml2-global-symbols.patch b/external/libxml2/libxml2-global-symbols.patch
index 49ee73731562..cfec9c530281 100644
--- a/external/libxml2/libxml2-global-symbols.patch
+++ b/external/libxml2/libxml2-global-symbols.patch
@@ -14,8 +14,8 @@
  
  LIBXML2_2.6.32 {
 @@ -2231,3 +2231,43 @@
-   xmlHashDefaultDeallocator;
- } LIBXML2_2.9.1;
+   xmlPopOutputCallbacks;
+ } LIBXML2_2.9.8;
  
 +# HACK: export global variable accessor functions (globals.h)
 +LIBXML2_GLOBAL_VARIABLES {
diff --git a/external/libxml2/ubsan.patch.0 b/external/libxml2/ubsan.patch.0
deleted file mode 100644
index b52259719673..000000000000
--- a/external/libxml2/ubsan.patch.0
+++ /dev/null
@@ -1,11 +0,0 @@
---- xpath.c
-+++ xpath.c
-@@ -14529,7 +14529,7 @@
- 	}
- 
- 	stream = xmlPatterncompile(str, dict, XML_PATTERN_XPATH,
--			&namespaces[0]);
-+			namespaces); // i.e., &namespaces[0] if namespaces != NULL
- 	if (namespaces != NULL) {
- 	    xmlFree((xmlChar **)namespaces);
- 	}
commit e851a48f87a81bb3393ac63013446cbc5033c0fc
Author:     Joshua Williams <joshmackwilliams at protonmail.com>
AuthorDate: Fri May 21 19:29:52 2021 -0500
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed May 26 11:49:49 2021 +0200

    tdf#142180 Swapped comparison operators for static strings
    
    It seems that, for some reason, the comparison operators for
    strings in basic were swapped in the code that evaluates
    string comparisons at compile-time. This is what caused
    bug #142180. This commit simply swaps the operators and
    should fix the bug.
    
    Change-Id: I14f90db8598f2f7f8b709e26902986e1f64af576
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115983
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit 6cdfd89413eab85dba7b975199358cb8fae44661)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115961
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/basic/qa/basic_coverage/test_string_literal_comparison.vb b/basic/qa/basic_coverage/test_string_literal_comparison.vb
new file mode 100644
index 000000000000..af63ede517dc
--- /dev/null
+++ b/basic/qa/basic_coverage/test_string_literal_comparison.vb
@@ -0,0 +1,19 @@
+' This file is part of the LibreOffice project.
+'
+' This Source Code Form is subject to the terms of the Mozilla Public
+' License, v. 2.0. If a copy of the MPL was not distributed with this
+' file, You can obtain one at http://mozilla.org/MPL/2.0/.
+'
+
+Function doUnitTest as Integer
+    ' tdf#142180 - Invalid text comparison result in Basic
+
+    doUnitTest = 0
+    If ( "Z" < "A" ) Then Exit Function
+    If ( "A" > "Z" ) Then Exit Function
+    If ( "A" < "A" ) Then Exit Function
+    If ( "A" > "A" ) Then Exit Function
+    If ( "Z" <= "A" ) Then Exit Function
+    If ( "A" >= "Z" ) Then Exit Function
+    doUnitTest = 1
+End Function
diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index 1771da0017f3..4192ceb8d49d 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -274,16 +274,16 @@ void SbiExprNode::FoldConstantsBinaryNode(SbiParser* pParser)
                 nVal = ( eRes != 0 ) ? SbxTRUE : SbxFALSE;
                 break;
             case LT:
-                nVal = ( eRes < 0 ) ? SbxTRUE : SbxFALSE;
+                nVal = ( eRes > 0 ) ? SbxTRUE : SbxFALSE;
                 break;
             case GT:
-                nVal = ( eRes > 0 ) ? SbxTRUE : SbxFALSE;
+                nVal = ( eRes < 0 ) ? SbxTRUE : SbxFALSE;
                 break;
             case LE:
-                nVal = ( eRes <= 0 ) ? SbxTRUE : SbxFALSE;
+                nVal = ( eRes >= 0 ) ? SbxTRUE : SbxFALSE;
                 break;
             case GE:
-                nVal = ( eRes >= 0 ) ? SbxTRUE : SbxFALSE;
+                nVal = ( eRes <= 0 ) ? SbxTRUE : SbxFALSE;
                 break;
             default:
                 pParser->Error( ERRCODE_BASIC_CONVERSION );
commit 9e6bb7e208a848498eae5f261a11776e1dc2b859
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri May 21 16:46:23 2021 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed May 26 11:49:49 2021 +0200

    tdf#142294 drop placeholder on-demand node on directly populating node
    
    Initially there's a <placeholder> entry to indicate the load-on-demand
    state.  It needs to be there for the expander indicator to be
    drawn/shown when there are no "real" entries yet.
    
    Typically the user clicks on the expander, the expansion remove the
    <placeholder> entry and calls the provided expander-callback which has
    the change to populate the node.
    
    Here RequestingChildrenHdl is the expander-callback (set via
    connect_expanding) and populates the node like it should.
    
    But then there are two places where it is called directly outside the
    expander-callback so it merrily appends entries into the node, but
    because it's called outside the expander-callback the <placeholder>
    entry was never removed which is then a problem because of the resulting
    inconsistency.
    
    Change-Id: Ie7d034e3f41832591438127c82eba85deb610952
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115952
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx
index 96088dd2611c..75e654388832 100644
--- a/sw/source/uibase/dbui/dbtree.cxx
+++ b/sw/source/uibase/dbui/dbtree.cxx
@@ -341,6 +341,7 @@ void SwDBTreeList::Select(const OUString& rDBName, const OUString& rTableName, c
             }
             if (!m_xTreeView->iter_has_child(*xParent))
             {
+                m_xTreeView->set_children_on_demand(*xParent, false); // tdf#142294 drop placeholder on-demand node
                 RequestingChildrenHdl(*xParent);
                 // If successful, it will be expanded in a call to scroll_to_row for its children
             }
@@ -362,6 +363,7 @@ void SwDBTreeList::Select(const OUString& rDBName, const OUString& rTableName, c
                     {
                         if (!m_xTreeView->iter_has_child(*xParent))
                         {
+                            m_xTreeView->set_children_on_demand(*xParent, false); // tdf#142294 drop placeholder on-demand node
                             RequestingChildrenHdl(*xParent);
                             m_xTreeView->expand_row(*xParent);
                         }
commit c619c25604eadeb282c16415684e6e54cf60ae6f
Author:     Bartosz Kosiorek <gang65 at poczta.onet.pl>
AuthorDate: Sat May 22 08:04:18 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed May 26 11:49:49 2021 +0200

    tdf#127145 WMF Fix displaying line width in ROUNDRECT record
    
    The EDGE optimization shouldn't be used for curves,
    otherwise strange issues appearing.
    
    Change-Id: Id677fc9002f0f79913ae756f0e456af7c9f7e507
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115984
    Tested-by: Jenkins
    Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>
    (cherry picked from commit b7c9ce6c86a11c6cacfa190b99052da388887c49)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115957

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 24e2e295e957..e74bb9ad3725 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -57,7 +57,8 @@ class Test : public test::BootstrapFixture, public XmlTestTools, public unotest:
     void TestEllipseXformIntersectClipRect();
     void TestDrawPolyLine16WithClip();
     void TestFillRegion();
-    void TestPalette();
+    void TestPaletteWMF();
+    void TestRoundrectWMF();
     void TestPolylinetoCloseStroke();
     void TestPolyLineWidth();
     void TestRoundRect();
@@ -86,7 +87,8 @@ public:
     CPPUNIT_TEST(TestEllipseXformIntersectClipRect);
     CPPUNIT_TEST(TestDrawPolyLine16WithClip);
     CPPUNIT_TEST(TestFillRegion);
-    CPPUNIT_TEST(TestPalette);
+    CPPUNIT_TEST(TestPaletteWMF);
+    CPPUNIT_TEST(TestRoundrectWMF);
     CPPUNIT_TEST(TestPolylinetoCloseStroke);
     CPPUNIT_TEST(TestPolyLineWidth);
     CPPUNIT_TEST(TestRoundRect);
@@ -477,8 +479,7 @@ void Test::TestPolylinetoCloseStroke()
                 "color", "#000000");
 }
 
-
-void Test::TestPalette()
+void Test::TestPaletteWMF()
 {
     // WMF import with records: CREATEPALETTE, SELECTOBJECT, CREATEPENINDIRECT, CREATEBRUSHINDIRECT, ELLIPSE.
     Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/wmf/data/TestPalette.wmf");
@@ -514,6 +515,26 @@ void Test::TestPalette()
                 "width", "132");
 }
 
+void Test::TestRoundrectWMF()
+{
+    // WMF records: ROUNDRECT, SETBKCOLOR, CREATEBRUSHINDIRECT
+    Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/wmf/data/TestRoundRect.wmf");
+    CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
+    drawinglayer::Primitive2dXmlDump dumper;
+    xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
+    CPPUNIT_ASSERT (pDocument);
+
+    assertXPath(pDocument, "/primitive2D/metafile/transform/polypolygoncolor",
+                "color", "#ffffff");
+
+    assertXPathContent(pDocument, "/primitive2D/metafile/transform/polygonstroke/polygon",
+                       "2865,661 2865,653 2865,645 2865,637 2865,621 2865,613 2865,605 2857,597 2857,589 2857,582 2857,566 2857,558 2849,550 2849,542 2849,534 2841,526 2841,518 2841,510 2833,502 2833,494 2825,486 2825,478 2817,470 2817,462 2809,454 2809,446 2801,438 2801,430 2793,422 2793,422 2785,414 2777,406 2777,398 2769,390 2761,390 2761,382 2753,374 2745,374 2737,366 2737,366 2729,358 2721,350 2714,350 2714,343 2706,343 2698,343 2690,335 2682,335 2682,335 2674,327 2666,327 2658,327 2650,327 2642,319 2634,319 2634,319 2626,319 2618,319 2610,319 573,319 565,319 557,319 549,319 549,319 541,319 533,327 525,327 517,327 509,327 501,335 501,335 493,335 485,343 477,343 469,343 469,350 462,350 454,358 446,366 446,366 438,374 430,374 422,382 422,390 414,390 406,398 406,406 398,414 390,422 390,422 382,430 382,438 374,446 374,454 366,462 366,470 358,478 358,486 350,494 350,502 342,510 342,518 342,526 334,534 334,542 334,550 326,558 326,566 326,582 326,589 326,597 318,605 318,613 318,621 31
 8,637 318,645 318,653 318,661 318,1673 318,1681 318,1689 318,1697 318,1713 318,1721 318,1729 326,1737 326,1745 326,1752 326,1768 326,1776 334,1784 334,1792 334,1800 342,1808 342,1816 342,1824 350,1832 350,1840 358,1848 358,1856 366,1864 366,1872 374,1880 374,1888 382,1896 382,1904 390,1912 390,1912 398,1920 406,1928 406,1936 414,1944 422,1944 422,1952 430,1960 438,1960 446,1968 446,1968 454,1976 462,1984 469,1984 469,1991 477,1991 485,1991 493,1999 501,1999 501,1999 509,2007 517,2007 525,2007 533,2007 541,2015 549,2015 549,2015 557,2015 565,2015 573,2015 2610,2015 2618,2015 2626,2015 2634,2015 2634,2015 2642,2015 2650,2007 2658,2007 2666,2007 2674,2007 2682,1999 2682,1999 2690,1999 2698,1991 2706,1991 2714,1991 2714,1984 2721,1984 2729,1976 2737,1968 2737,1968 2745,1960 2753,1960 2761,1952 2761,1944 2769,1944 2777,1936 2777,1928 2785,1920 2793,1912 2793,1912 2801,1904 2801,1896 2809,1888 2809,1880 2817,1872 2817,1864 2825,1856 2825,1848 2833,1840 2833,1832 2841,1824 2841,1816 2841,1
 808 2849,1800 2849,1792 2849,1784 2857,1776 2857,1768 2857,1752 2857,1745 2857,1737 2865,1729 2865,1721 2865,1713 2865,1697 2865,1689 2865,1681 2865,1673");
+    assertXPath(pDocument, "/primitive2D/metafile/transform/polygonstroke/line",
+                "color", "#000000");
+    assertXPath(pDocument, "/primitive2D/metafile/transform/polygonstroke/line",
+                "width", "143");
+}
+
 void Test::TestPolyLineWidth()
 {
     // EMF import with records: CREATEPEN, ROUNDRECT.
diff --git a/emfio/qa/cppunit/wmf/data/TestRoundRect.wmf b/emfio/qa/cppunit/wmf/data/TestRoundRect.wmf
new file mode 100644
index 000000000000..cf4dee52b858
Binary files /dev/null and b/emfio/qa/cppunit/wmf/data/TestRoundRect.wmf differ
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 14c52a6327e8..0d918af72dc0 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -1420,7 +1420,6 @@ namespace emfio
         if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LineStyle::Dash ) )
         {
             tools::Polygon aRoundRectPoly( rRect, rSize.Width(), rSize.Height() );
-            aRoundRectPoly.Optimize( PolyOptimizeFlags::EDGES );
             mpGDIMetaFile->AddAction( new MetaPolyLineAction( ImplMap( aRoundRectPoly ), maLineStyle.aLineInfo ) );
         }
     }
commit 1fa6fd827e28b77e78eda0c98cf154cbaf0963ff
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri May 21 00:03:43 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed May 26 11:49:49 2021 +0200

    tdf#142395: properly handle "no string delimiter" case
    
    In this case, the delimiter character value would be '\0'.
    
    Change-Id: Idb0f01756991b3ea35a92f11b78fddd56c25265a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115839
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit 6155689bb6f1d72f29b43ac5ae94b32522ef9b42)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115851
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 4db43588af50..43d77256a08a 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1553,7 +1553,7 @@ const sal_Unicode* ScImportExport::ScanNextFieldFromString( const sal_Unicode* p
     rbIsQuoted = false;
     rField.clear();
     const sal_Unicode cBlank = ' ';
-    if (!ScGlobal::UnicodeStrChr( pSeps, cBlank))
+    if (cStr && !ScGlobal::UnicodeStrChr(pSeps, cBlank))
     {
         // Cope with broken generators that put leading blanks before a quoted
         // field, like "field1", "field2", "..."
@@ -1564,7 +1564,7 @@ const sal_Unicode* ScImportExport::ScanNextFieldFromString( const sal_Unicode* p
         if (*pb == cStr)
             p = pb;
     }
-    if ( *p == cStr )           // String in quotes
+    if (cStr && *p == cStr) // String in quotes
     {
         rbIsQuoted = true;
         const sal_Unicode* p1;
commit de8cd48c3f6f18b21a374a1a6cc2325328d493db
Author:     Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Fri May 21 12:20:28 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed May 26 11:49:48 2021 +0200

    sw: layout: fix footnote UAF on tdf132248-3.odt (also, tdf134127-1.odt)
    
    Text frame 12 gets a follow 137 which gets a follow 138, and there's
    a footnote at index 95.
    
    When 138 is created, its mnOffest is 63 in SwTextFrame::SplitFrame()
    so 138 gets its mbFootnote set and the footnote frame mpReference points
    to 138 but then SwTextFrame::FormatAdjust() moves one line back and sets
    the offset of 138 to 96.
    
    Then SwTextFrame::CalcFollow() clears 138's mbFootnote due to lack of
    footnotes starting from 96.
    
    Later frame 138 is joined, but because its mbFootnote is false, the
    footnote's mpReference continues to point to it, which leads to UAF in
    SwFootnoteFrame::GetRef().
    
    What's missing is that at the time when the offset of 138 is adjusted,
    RemoveFootnote() must be called, as is already the case in another
    branch of SwTextFrame::FormatAdjust(), since CVS initial import.
    
    Not sure why this started to crash in crashtesting relatively recently.
    
    Change-Id: Ic46019d34ff90d24d0f23effe8a6d54d6f197a71
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115910
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
    (cherry picked from commit 95a716f12a0dacdd5d80a6f3d98eadcc2f079fcf)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115843
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 731ecdc324bf..ac9c2f95da05 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -986,7 +986,7 @@ bool SwTextFrame::CalcPreps()
     return bRet;
 }
 
-// We rewire the footnotes and the character bound objects
+// Move the as-character objects - footnotes must be moved by RemoveFootnote!
 void SwTextFrame::ChangeOffset( SwTextFrame* pFrame, TextFrameIndex nNew )
 {
     if( pFrame->GetOffset() < nNew )
@@ -1081,6 +1081,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
         // need to create a Follow.
         // We also need to do this if the whole mass of text remains in the Master,
         // because a hard line break could necessitate another line (without text mass)!
+        TextFrameIndex const nOld(nEnd);
         nEnd = rLine.GetEnd();
         if( GetFollow() )
         {
@@ -1106,6 +1107,13 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
                 // for the paragraph mark.
                 nNew |= 1;
             }
+            // move footnotes if the follow is kept - if RemoveFootnote() is
+            // called in next format iteration, it will be with the *new*
+            // offset so no effect!
+            if (nNew && nOld < nEnd)
+            {
+                RemoveFootnote(nOld, nEnd - nOld);
+            }
             ChangeOffset( GetFollow(), nEnd );
             GetFollow()->ManipOfst( nEnd );
         }


More information about the Libreoffice-commits mailing list