[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-4+backports' - 24 commits - desktop/source download.lst external/postgresql filter/source include/vcl libreofficekit/qa lotuswordpro/qa lotuswordpro/source RepositoryExternal.mk sc/source sfx2/source solenv/flatpak-manifest.in sw/source toolkit/source vcl/source vcl/unx writerfilter/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 25 10:20:24 UTC 2021


 RepositoryExternal.mk                                    |   24 ++-
 desktop/source/lib/init.cxx                              |    6 
 download.lst                                             |    4 
 external/postgresql/ExternalPackage_postgresql.mk        |   16 ++
 external/postgresql/ExternalProject_postgresql.mk        |   16 +-
 external/postgresql/Module_postgresql.mk                 |    6 
 external/postgresql/UnpackedTarball_postgresql.mk        |   11 -
 external/postgresql/config.pl                            |    1 
 external/postgresql/internal-zlib.patch.1                |   29 ---
 external/postgresql/postgres-msvc-build.patch.1          |  110 +++++++++++++++
 external/postgresql/postgresql-9.2.1-libreoffice.patch   |   74 ----------
 external/postgresql/postgresql-libs-leak.patch           |   40 -----
 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 +++++---
 solenv/flatpak-manifest.in                               |    6 
 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 +-
 toolkit/source/controls/controlmodelcontainerbase.cxx    |    2 
 vcl/source/font/fontcharmap.cxx                          |   18 +-
 vcl/unx/generic/app/i18n_cb.cxx                          |    4 
 vcl/unx/gtk3/gtk3gtkinst.cxx                             |    2 
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx    |    2 
 41 files changed, 404 insertions(+), 296 deletions(-)

New commits:
commit fa985a0e4b709bf41e961075a071de30e9f8ea2d
Author:     Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Fri Jan 22 19:23:04 2021 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:54 2021 +0100

    vcl: fix SalGtkXWindow::getPosSize()
    
    This function was introduced with commit
    9869ca098765ed5ec0325492fa2cdce4a5bab795 and never existed on master?
    Very mysterious...
    
    vcl/unx/gtk3/gtk3gtkinst.cxx:13213:46: error: ‘y’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    13213 |         return css::awt::Rectangle(x, y, w, h);
    
    Change-Id: I277253be7302ec04961b918c8588b441e6e87ba5

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 247d72917f69..ff2095c32621 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -13209,7 +13209,7 @@ css::awt::Rectangle SAL_CALL SalGtkXWindow::getPosSize()
     {
         gint w, h, x, y;
         gtk_window_get_size(GTK_WINDOW(m_pWidget), &w, &h);
-        gtk_window_get_position(GTK_WINDOW(m_pWidget), &x, &x);
+        gtk_window_get_position(GTK_WINDOW(m_pWidget), &x, &y);
         return css::awt::Rectangle(x, y, w, h);
     }
     else {
commit e5fa1aa39cd2a621c1618abcf6e4ff040c97a569
Author:     Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Fri Jan 22 21:08:45 2021 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:54 2021 +0100

    fix -Wmaybe-uninitialized
    
    Change-Id: I0dc16e51ea45069ae207c6440db879143d89cf2c

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 19dc3bb917e0..70d0e7a6a816 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1674,7 +1674,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 eecccbf2a99f9bae366cffd0a5c53e525ef90916
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Dec 9 15:18:06 2019 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:53 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 88e82c0ee3f1..39f7b9e89b79 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -40,6 +40,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>
@@ -3485,17 +3486,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 72caa1f19cb5654352567086bec79796ee86f99a
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Dec 3 13:35:49 2019 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:53 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 4925c7841ee2..dd74d30523bc 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 e50f2179b5a18ed10c4291dcac7a6e7fd1a725dc
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Dec 3 13:26:52 2019 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:53 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 53731ac2126c..a48f4fb7b59e 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -85,6 +85,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>
@@ -1192,8 +1193,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 57aed84044cc00608ac6e8f501aa939755643c6d
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Dec 3 13:25:39 2019 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:53 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 cb580785e8a8..45f732ff4b4d 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>
@@ -693,21 +693,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 f51f2be924c00d769f7cb838d71726350d4dd77b
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Dec 4 16:33:54 2019 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:52 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 29fd41a9879c..fc53af3685a4 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>
@@ -4631,11 +4633,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 c859556fad59a66c9c3a1cc117ae942229cfa441
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Dec 3 13:56:57 2019 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:52 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 9849ac86d642..cf27e3493bf0 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 1e1e386752c95d1a1b106f5c92732d9a049e41ce
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Sep 26 11:38:51 2020 +0200
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:52 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 aefbc8a59bd7a3302f9253322135e2fd0f859ed7
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed May 20 14:17:36 2020 +0200
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:52 2021 +0100

    fix -Werror=maybe-uninitialized
    
    Change-Id: I718016b5f9120c18868ed798785af1f8108be25b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94569
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit 7daab7859f3b5b4297c45ac1631c68387192a962)

diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx
index 3b2fcaa891a7..971fc0fd0825 100644
--- a/toolkit/source/controls/controlmodelcontainerbase.cxx
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -753,7 +753,7 @@ sal_Bool SAL_CALL ControlModelContainerBase::getEnabled()
 {
     SolarMutexGuard aGuard;
     Reference<XPropertySet> xThis(*this, UNO_QUERY);
-    bool bEnabled;
+    bool bEnabled = false;
     xThis->getPropertyValue(GetPropertyName(BASEPROPERTY_ENABLED)) >>= bEnabled;
     return bEnabled;
 }
commit 86f4db5deae397380918d47578007fe8ca379182
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Dec 4 16:51:28 2019 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:51 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 2bb124c365eea38575d0fa4fbd554de90e272267
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Nov 24 13:06:13 2020 +0000
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:51 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 8e295f67e93c5e10db7b77052af4cdf27e30e426
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Nov 3 16:53:55 2020 +0000
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:51 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 44812a67ad1f..f5bdacffe32d 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2170,7 +2170,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 );
@@ -4260,7 +4260,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 61e30e6618ed..74953aa2016c 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1196,7 +1196,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 f0a12ad3005e..6edc842e48ee 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2399,18 +2399,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);
         }
     }
 
@@ -2797,7 +2799,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 499fdc8e223e..1e68d7a592b4 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2716,7 +2716,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 3cf840fabf8218deec7aec4901644d93414ac9af
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Oct 27 10:12:37 2020 +0000
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:51 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 b931ef8af3a4251bea14bc3a4d61cffb95a7f777
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Oct 26 20:38:03 2020 +0000
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:50 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 58eaaaab715e..b3dc2b12ee5c 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -325,6 +325,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;
@@ -360,7 +369,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 f324b3156cffd004879d918840ada313a98c0849
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Oct 18 20:36:16 2020 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:50 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 f64859171dc6..2d5ba97d105f 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 f9cb7e5274befe0b422716fa55f3829f63f33b90
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Oct 3 21:56:19 2020 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:50 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 419fdda2475293ae06ad0c05bde570345456645c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 29 20:59:40 2020 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:50 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 6f7ce5342b3a2cc74a0e124cc560769587f1392e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Mar 7 19:24:42 2020 +0000
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:49 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 32c8ba59dc2d93799f8df28982f7017ca1f304c9
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Feb 7 14:09:57 2020 +0000
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:49 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 ac8140fe4424e123bd8cabc5de083035ffbc12ce
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Feb 1 11:21:10 2020 +0000
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:49 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 8a92792dadccf2e33c8d359e362cc0f00ffff3c6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jan 28 16:43:28 2020 +0000
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:49 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 6e4ba9796bde0e675e8038f298863d720fe15963
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Feb 1 12:04:26 2020 +0000
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:48 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)
commit 88f7563e51442773bd8b3fe35e8800b135e08262
Author:     Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Tue Jan 19 15:38:05 2021 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Mon Jan 25 11:18:48 2021 +0100

    postgresql: upgrade to release 13.1
    
    Fixes CVE-2020-25694, plus a bunch more CVE that don't look relevant.
    
    * --with-krb5 no longer exists, neither does --disable-shared
    * remove internal-zlib.patch.1:
      zlib is only used by pg_* tools / contrib/pgcrypto
    * remove postgresql-libs-leak.patch:
      some relic from pre-gbuild times, not clear what the point is for
      static libs
    * remove postgresql-9.2.1-libreoffice.patch:
      another dmake .mk file relic, and the win32 nmake build system was
      removed
    * add postgres-msvc-build.patch.1 to fix Cygwin perl and openssl
    * on WNT, libpq.dll is now built, no longer static lib
    
    postgresql: fix mistake in RepositoryExternal.mk
    
    Change-Id: Ic0232a28801b2f604d9f4e33d5621ae3362defaa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109640
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
    (cherry picked from commit 234833f7823a1424b62c93e145f0cfe2c6b6efd5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109698
    Reviewed-by: Thorsten Behrens <thorsten.behrens at allotropia.de>
    (cherry picked from commit 1362bf7fa2957d34a7cef18dd95ede22cc42787f)

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index c5c888f143c3..3d2d61dfc2b4 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3027,9 +3027,15 @@ endef
 
 else # !SYSTEM_POSTGRESQL
 
+ifeq ($(OS),WNT)
+$(eval $(call gb_Helper_register_packages_for_install,postgresqlsdbc,\
+	postgresql \
+))
+endif # WNT
+
 define gb_LinkTarget__use_postgresql
 
-$(call gb_LinkTarget_use_external_project,$(1),postgresql)
+$(call gb_LinkTarget_use_external_project,$(1),postgresql,full)
 
 $(call gb_LinkTarget_set_include,$(1),\
 	-I$(call gb_UnpackedTarball_get_dir,postgresql)/src/include \
@@ -3037,19 +3043,21 @@ $(call gb_LinkTarget_set_include,$(1),\
 	$$(INCLUDE) \
 )
 
+ifeq ($(OS),WNT)
+
 $(call gb_LinkTarget_add_libs,$(1),\
-	$(call gb_UnpackedTarball_get_dir,postgresql)/src/interfaces/libpq/libpq$(gb_StaticLibrary_PLAINEXT) \
+	$(call gb_UnpackedTarball_get_dir,postgresql)/$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release)/libpq/libpq.lib \
 )
 
-ifeq ($(OS),WNT)
-$(call gb_LinkTarget_use_external,$(1),openssl)
+else # WNT
 
-$(call gb_LinkTarget_use_system_win32_libs,$(1),\
-	secur32 \
-	ws2_32 \
+$(call gb_LinkTarget_add_libs,$(1),\
+	$(call gb_UnpackedTarball_get_dir,postgresql)/src/interfaces/libpq/libpq$(gb_StaticLibrary_PLAINEXT) \
+	$(call gb_UnpackedTarball_get_dir,postgresql)/src/common/libpgcommon$(gb_StaticLibrary_PLAINEXT) \
+	$(call gb_UnpackedTarball_get_dir,postgresql)/src/port/libpgport$(gb_StaticLibrary_PLAINEXT) \
 )
 
-endif
+endif # WNT
 
 endef
 
diff --git a/download.lst b/download.lst
index 815ac5b1195a..bdbed280f3e0 100644
--- a/download.lst
+++ b/download.lst
@@ -210,8 +210,8 @@ export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201f
 export LIBPNG_TARBALL := libpng-1.6.37.tar.xz
 export POPPLER_SHA256SUM := 016dde34e5f868ea98a32ca99b643325a9682281500942b7113f4ec88d20e2f3
 export POPPLER_TARBALL := poppler-21.01.0.tar.xz
-export POSTGRESQL_SHA256SUM := a754c02f7051c2f21e52f8669a421b50485afcde9a581674d6106326b189d126
-export POSTGRESQL_TARBALL := postgresql-9.2.24.tar.bz2
+export POSTGRESQL_SHA256SUM := 12345c83b89aa29808568977f5200d6da00f88a035517f925293355432ffe61f
+export POSTGRESQL_TARBALL := postgresql-13.1.tar.bz2
 export PYTHON_SHA256SUM := 06a0a9f1bf0d8cd1e4121194d666c4e28ddae4dd54346de6c343206599f02136
 export PYTHON_TARBALL := Python-3.7.7.tar.xz
 export QRCODEGEN_SHA256SUM := fcdf9fd69fde07ae4dca2351d84271a9de8093002f733b77c70f52f1630f6e4a
diff --git a/external/postgresql/ExternalPackage_postgresql.mk b/external/postgresql/ExternalPackage_postgresql.mk
new file mode 100644
index 000000000000..f6c9a9bb6deb
--- /dev/null
+++ b/external/postgresql/ExternalPackage_postgresql.mk
@@ -0,0 +1,16 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_ExternalPackage_ExternalPackage,postgresql,postgresql))
+
+$(eval $(call gb_ExternalPackage_use_external_project,postgresql,postgresql))
+
+$(eval $(call gb_ExternalPackage_add_file,postgresql,$(LIBO_LIB_FOLDER)/libpq.dll,$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release)/libpq/libpq.dll))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/postgresql/ExternalProject_postgresql.mk b/external/postgresql/ExternalProject_postgresql.mk
index ba462a34a1a1..001c3f961ac8 100644
--- a/external/postgresql/ExternalProject_postgresql.mk
+++ b/external/postgresql/ExternalProject_postgresql.mk
@@ -12,7 +12,6 @@ $(eval $(call gb_ExternalProject_ExternalProject,postgresql))
 $(eval $(call gb_ExternalProject_use_externals,postgresql,\
 	$(if $(ENABLE_LDAP),openldap) \
 	openssl \
-	zlib \
 ))
 
 $(eval $(call gb_ExternalProject_register_targets,postgresql,\
@@ -25,8 +24,9 @@ $(eval $(call gb_ExternalProject_use_nmake,postgresql,build))
 
 $(call gb_ExternalProject_get_state_target,postgresql,build) :
 	$(call gb_ExternalProject_run,build,\
-		nmake -f win32.mak USE_SSL=1 USE_LDAP=1 \
-	,src)
+		MSBFLAGS=/p:Platform=$(if $(filter X86_64,$(CPUNAME)),x64,Win32) \
+		$(PERL) build.pl $(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) libpq \
+	,src/tools/msvc)
 
 else
 
@@ -55,21 +55,25 @@ postgresql_LDFLAGS  += \
 
 endif
 
+# note: as of 13.1, zlib is not needed by libpq
+# passing MAKELEVEL=0 is required to find internal headers
 
 $(call gb_ExternalProject_get_state_target,postgresql,build) :
 	$(call gb_ExternalProject_run,build,\
 		./configure \
-			--without-readline --disable-shared --with-ldap \
+			--without-readline \
+			--without-zlib \
+			--with-ldap \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
 			$(if $(DISABLE_OPENSSL),,--with-openssl \
-				$(if $(WITH_KRB5), --with-krb5) \
 				$(if $(WITH_GSSAPI),--with-gssapi)) \
 				$(if $(ENABLE_LDAP),,--with-ldap=no) \
+			CFLAGS="-fPIC" \
 			CPPFLAGS="$(postgresql_CPPFLAGS)" \
 			LDFLAGS="$(postgresql_LDFLAGS)" \
 			$(if $(ENABLE_LDAP),EXTRA_LDAP_LIBS="-llber -lssl3 -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4") \
 		&& cd src/interfaces/libpq \
-		&& MAKEFLAGS= && $(MAKE) all-static-lib)
+		&& MAKEFLAGS= && $(MAKE) MAKELEVEL=0 all-static-lib)
 
 endif
 
diff --git a/external/postgresql/Module_postgresql.mk b/external/postgresql/Module_postgresql.mk
index 1f655c6e5034..7ea89dad3b39 100644
--- a/external/postgresql/Module_postgresql.mk
+++ b/external/postgresql/Module_postgresql.mk
@@ -14,4 +14,10 @@ $(eval $(call gb_Module_add_targets,postgresql,\
 	UnpackedTarball_postgresql \
 ))
 
+ifeq ($(OS),WNT)
+$(eval $(call gb_Module_add_targets,postgresql,\
+	ExternalPackage_postgresql \
+))
+endif # WNT
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/postgresql/UnpackedTarball_postgresql.mk b/external/postgresql/UnpackedTarball_postgresql.mk
index a7e57ab93301..6c941f1e9b22 100644
--- a/external/postgresql/UnpackedTarball_postgresql.mk
+++ b/external/postgresql/UnpackedTarball_postgresql.mk
@@ -11,19 +11,12 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,postgresql))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,postgresql,$(POSTGRESQL_TARBALL),,postgresql))
 
-$(eval $(call gb_UnpackedTarball_set_patchlevel,postgresql,3))
-
 $(eval $(call gb_UnpackedTarball_add_patches,postgresql, \
-	external/postgresql/postgresql-libs-leak.patch \
-	external/postgresql/postgresql-9.2.1-libreoffice.patch \
 	external/postgresql/windows.patch.0 \
+	external/postgresql/postgres-msvc-build.patch.1 \
 ))
 
-ifeq ($(SYSTEM_ZLIB),)
-$(eval $(call gb_UnpackedTarball_add_patches,postgresql, \
-	external/postgresql/internal-zlib.patch.1 \
-))
-endif
+$(eval $(call gb_UnpackedTarball_add_file,postgresql,src/tools/msvc/config.pl,external/postgresql/config.pl))
 
 $(eval $(call gb_UnpackedTarball_update_autoconf_configs,postgresql))
 
diff --git a/external/postgresql/config.pl b/external/postgresql/config.pl
new file mode 100644
index 000000000000..ae163ebbd166
--- /dev/null
+++ b/external/postgresql/config.pl
@@ -0,0 +1 @@
+$config->{openssl} = "$ENV{WORKDIR}/UnpackedTarball/openssl";
diff --git a/external/postgresql/internal-zlib.patch.1 b/external/postgresql/internal-zlib.patch.1
deleted file mode 100644
index ac2b728e1314..000000000000
--- a/external/postgresql/internal-zlib.patch.1
+++ /dev/null
@@ -1,29 +0,0 @@
-diff -up postgresql/configure.dt postgresql/configure
---- postgresql/configure.dt	2016-11-03 17:34:17.282388226 +0100
-+++ postgresql/configure	2016-11-03 17:34:35.004202484 +0100
-@@ -8566,13 +8566,13 @@ fi
- 
- if test "$with_zlib" = yes; then
- 
--{ $as_echo "$as_me:$LINENO: checking for inflate in -lz" >&5
--$as_echo_n "checking for inflate in -lz... " >&6; }
-+{ $as_echo "$as_me:$LINENO: checking for inflate in -lzlib" >&5
-+$as_echo_n "checking for inflate in -lzlib... " >&6; }
- if test "${ac_cv_lib_z_inflate+set}" = set; then
-   $as_echo_n "(cached) " >&6
- else
-   ac_check_lib_save_LIBS=$LIBS
--LIBS="-lz  $LIBS"
-+LIBS="-lzlib  $LIBS"
- cat >conftest.$ac_ext <<_ACEOF
- /* confdefs.h.  */
- _ACEOF
-@@ -8636,7 +8636,7 @@ if test "x$ac_cv_lib_z_inflate" = x""yes
- #define HAVE_LIBZ 1
- _ACEOF
- 
--  LIBS="-lz $LIBS"
-+  LIBS="-lzlib $LIBS"
- 
- else
-   { { $as_echo "$as_me:$LINENO: error: zlib library not found
diff --git a/external/postgresql/postgres-msvc-build.patch.1 b/external/postgresql/postgres-msvc-build.patch.1
new file mode 100644
index 000000000000..4ccd82aa28fb
--- /dev/null
+++ b/external/postgresql/postgres-msvc-build.patch.1
@@ -0,0 +1,110 @@
+Cygwin perl calls /bin/sh which can't resolve to .exe
+
+Also Cygwin perl has $Config{osname} different from MSWin32, and why even check that?
+
+--- postgresql/src/tools/msvc/build.pl.orig	2021-01-19 17:36:09.801463500 +0100
++++ postgresql/src/tools/msvc/build.pl	2021-01-19 17:36:20.426821300 +0100
+@@ -55,13 +55,13 @@
+ if ($buildwhat)
+ {
+ 	system(
+-		"msbuild $buildwhat.vcxproj /verbosity:normal $msbflags /p:Configuration=$bconf"
++		"msbuild.exe $buildwhat.vcxproj /verbosity:normal $msbflags /p:Configuration=$bconf"
+ 	);
+ }
+ else
+ {
+ 	system(
+-		"msbuild pgsql.sln /verbosity:normal $msbflags /p:Configuration=$bconf"
++		"msbuild.exe pgsql.sln /verbosity:normal $msbflags /p:Configuration=$bconf"
+ 	);
+ }
+ 
+--- postgresql/src/tools/msvc/Project.pm.orig	2021-01-19 17:59:18.799237700 +0100
++++ postgresql/src/tools/msvc/Project.pm	2021-01-19 17:59:48.487711700 +0100
+@@ -22,7 +22,7 @@
+ 	my $self = {
+ 		name                  => $name,
+ 		type                  => $type,
+-		guid                  => $^O eq "MSWin32" ? Win32::GuidGen() : 'FAKE',
++		guid                  => Win32::GuidGen(),
+ 		files                 => {},
+ 		references            => [],
+ 		libraries             => [],
+--- postgresql/src/tools/msvc/Solution.pm.orig	2021-01-19 18:03:04.594229100 +0100
++++ postgresql/src/tools/msvc/Solution.pm	2021-01-19 18:04:13.677610100 +0100
+@@ -59,7 +59,7 @@
+ {
+ 	my $self = shift;
+ 
+-	if ($^O eq "MSWin32")
++	if (1) #($^O eq "MSWin32")
+ 	{
+ 		# Examine CL help output to determine if we are in 32 or 64-bit mode.
+ 		my $output = `cl /? 2>&1`;
+@@ -1081,7 +1081,7 @@
+ 		}
+ 		if ($fld ne "")
+ 		{
+-			$flduid{$fld} = $^O eq "MSWin32" ? Win32::GuidGen() : 'FAKE';
++			$flduid{$fld} = Win32::GuidGen();
+ 			print $sln <<EOF;
+ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "$fld", "$fld", "$flduid{$fld}"
+ EndProject
+--- postgresql/src/tools/msvc/VSObjectFactory.pm.orig	2021-01-19 18:06:42.633421700 +0100
++++ postgresql/src/tools/msvc/VSObjectFactory.pm	2021-01-19 18:06:28.663523200 +0100
+@@ -111,7 +111,7 @@
+ 
+ sub DetermineVisualStudioVersion
+ {
+-	if ($^O eq "MSWin32")
++	if (1) # ($^O eq "MSWin32")
+ 	{
+ 		# To determine version of Visual Studio we use nmake as it has
+ 		# existed for a long time and still exists in current Visual
+--- postgresql/src/tools/msvc/Mkvcbuild.pm.orig	2021-01-19 18:23:59.830153900 +0100
++++ postgresql/src/tools/msvc/Mkvcbuild.pm	2021-01-19 18:24:04.095411300 +0100
+@@ -9,7 +9,7 @@
+ use warnings;
+ 
+ use Carp;
+-use if ($^O eq "MSWin32"), 'Win32';
++use Win32;
+ use Project;
+ use Solution;
+ use Cwd;
+--- postgresql/src/tools/msvc/Solution.pm.orig	2021-01-19 20:27:21.366237600 +0100
++++ postgresql/src/tools/msvc/Solution.pm	2021-01-19 20:28:17.773662900 +0100
+@@ -126,7 +126,8 @@
+ 	# openssl.exe is in the specified directory.
+ 	# Quote the .exe name in case it has spaces
+ 	my $opensslcmd =
+-	  qq("$self->{options}->{openssl}\\bin\\openssl.exe" version 2>&1);
++	  qq("$self->{options}->{openssl}\\out32dll\\openssl.exe" version 2>&1);
++ print "$opensslcmd";
+ 	my $sslout = `$opensslcmd`;
+ 
+ 	$? >> 8 == 0
+@@ -964,8 +964,8 @@
+ 				# On both Win32 and Win64 the same library
+ 				# names are used without a debugging context.
+ 				$dbgsuffix     = 0;
+-				$libsslpath    = '\lib\libssl.lib';
+-				$libcryptopath = '\lib\libcrypto.lib';
++				$libsslpath    = '\libssl.lib';
++				$libcryptopath = '\libcrypto.lib';
+ 			}
+ 
+ 			$proj->AddLibrary($self->{options}->{openssl} . $libsslpath,
+@@ -990,9 +990,9 @@
+ 				# to be here, so don't ask for it in last
+ 				# parameter.
+ 				$proj->AddLibrary(
+-					$self->{options}->{openssl} . '\lib\ssleay32.lib', 0);
++					$self->{options}->{openssl} . '\out32dll\ssleay32.lib', 0);
+ 				$proj->AddLibrary(
+-					$self->{options}->{openssl} . '\lib\libeay32.lib', 0);
++					$self->{options}->{openssl} . '\out32dll\libeay32.lib', 0);
+ 			}
+ 		}
+ 	}
diff --git a/external/postgresql/postgresql-9.2.1-libreoffice.patch b/external/postgresql/postgresql-9.2.1-libreoffice.patch
deleted file mode 100644
index 174ee8551a78..000000000000
--- a/external/postgresql/postgresql-9.2.1-libreoffice.patch
+++ /dev/null
@@ -1,74 +0,0 @@
---- misc/build/postgresql-9.1.1/src/interfaces/libpq/Makefile	2011-09-22 23:57:57.000000000 +0200
-+++ misc/build/postgresql-9.1.1.patched/src/interfaces/libpq/Makefile	2011-12-15 09:02:18.000000000 +0100
-@@ -148,3 +148,6 @@
- maintainer-clean: distclean maintainer-clean-lib
- 	$(MAKE) -C test $@
- 	rm -f libpq-dist.rc
-+
-+libpq-flags.mk:
-+	@printf '%s\n' 'LIBPQ_DEP_LIBS+=$(SHLIB_LINK)' > '$@'
---- misc/build/postgresql-9.1.1/src/interfaces/libpq/win32.mak	2011-12-14 14:28:59.000000000 +0100
-+++ misc/build/postgresql-9.1.1.patched/src/interfaces/libpq/win32.mak	2011-12-15 09:11:37.000000000 +0100
-@@ -11,14 +11,12 @@
- !ENDIF
- 
- !IFDEF DEBUG
--OPT=/Od /Zi /MDd
-+OPT=/Od /Zi
- LOPT=/DEBUG
--DEBUGDEF=/D _DEBUG
--OUTFILENAME=libpqd
-+OUTFILENAME=libpq
- !ELSE
- OPT=/O2 /MD
- LOPT=
--DEBUGDEF=/D NDEBUG
- OUTFILENAME=libpq
- !ENDIF
- 
-@@ -67,18 +66,11 @@
- CPP=cl.exe
- RSC=rc.exe
- 
--!IFDEF DEBUG
--OUTDIR=.\Debug
--INTDIR=.\Debug
--CPP_OBJS=.\Debug/
--!ELSE
--OUTDIR=.\Release
--INTDIR=.\Release
--CPP_OBJS=.\Release/
--!ENDIF
--
-+OUTDIR=.
-+INTDIR=.
-+CPP_OBJS=./
- 
--ALL : config "$(OUTDIR)\$(OUTFILENAME).lib" "$(OUTDIR)\$(OUTFILENAME).dll"
-+ALL : config "$(OUTDIR)\$(OUTFILENAME).lib"
- 
- CLEAN :
- 	- at erase "$(INTDIR)\getaddrinfo.obj"
-@@ -178,10 +170,11 @@
- "$(OUTDIR)" :
-     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
- 
--CPP_PROJ=/nologo /W3 /EHsc $(OPT) /I "..\..\include" /I "..\..\include\port\win32" /I "..\..\include\port\win32_msvc" /I "..\..\port" /I. /I "$(SSL_INC)" \
-+CPP_PROJ=/nologo /W3 /EHsc $(OPT) /I "..\..\include" /I "..\..\include\port\win32" /I "..\..\include\port\win32_msvc" /I "..\..\port" /I. $(SOLARINC) /I $(WORKDIR)/UnpackedTarball/openssl/include \
-  /D "FRONTEND" $(DEBUGDEF) \
-  /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq.pch" \
-  /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c  \
-+ /D "_CRT_NONSTDC_NO_DEPRECATE" \
-  /D "_CRT_SECURE_NO_DEPRECATE" $(ADD_DEFINES)
- 
- !IFDEF USE_SSL
-@@ -222,7 +215,7 @@
- <<
- 
- "$(INTDIR)\libpq.res" : "$(INTDIR)" libpq-dist.rc
--	$(RSC) $(RSC_PROJ) libpq-dist.rc
-+	$(RSC) $(SOLARINC) $(RSC_PROJ) libpq-dist.rc
- 
- 
- "$(OUTDIR)\$(OUTFILENAME).dll" : "$(OUTDIR)" "$(INTDIR)\libpq.res"
-
diff --git a/external/postgresql/postgresql-libs-leak.patch b/external/postgresql/postgresql-libs-leak.patch
deleted file mode 100644
index 8224137f1f97..000000000000
--- a/external/postgresql/postgresql-libs-leak.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-diff --recursive -u misc/build/postgresql-9.1.1/configure.in misc/build/postgresql-9.1.1.patched/configure.in
---- misc/build/postgresql-9.1.1/configure.in	2011-09-22 23:57:57.000000000 +0200
-+++ misc/build/postgresql-9.1.1.patched/configure.in	2012-02-03 11:42:45.000000000 +0100
-@@ -903,18 +903,9 @@
- *** Not using spinlocks will cause poor performance.])
- fi
- 
--if test "$with_gssapi" = yes ; then
--  if test "$PORTNAME" != "win32"; then
--    AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
--		 		  [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
--  else
--    LIBS="$LIBS -lgssapi32"
--  fi
--fi
--
- if test "$with_krb5" = yes ; then
-   if test "$PORTNAME" != "win32"; then
--     AC_SEARCH_LIBS(com_err, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken' com_err 'com_err -lssl -lcrypto'], [],
-+     AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
-                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
-      AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
-                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
-@@ -924,6 +915,15 @@
-   fi
- fi
- 
-+if test "$with_gssapi" = yes ; then
-+  if test "$PORTNAME" != "win32"; then
-+    AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
-+		 		  [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
-+  else
-+    LIBS="$LIBS -lgssapi32"
-+  fi
-+fi
-+
- if test "$with_openssl" = yes ; then
-   dnl Order matters!
-   if test "$PORTNAME" != "win32"; then
-
diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in
index b624ffcb512e..c5f7d8f4ae16 100644
--- a/solenv/flatpak-manifest.in
+++ b/solenv/flatpak-manifest.in
@@ -381,10 +381,10 @@
                     "dest-filename": "external/tarballs/poppler-0.82.0.tar.xz"
                 },
                 {
-                    "url": "https://dev-www.libreoffice.org/src/postgresql-9.2.24.tar.bz2",
-                    "sha256": "a754c02f7051c2f21e52f8669a421b50485afcde9a581674d6106326b189d126",
+                    "url": "https://dev-www.libreoffice.org/src/postgresql-13.1.tar.bz2",
+                    "sha256": "12345c83b89aa29808568977f5200d6da00f88a035517f925293355432ffe61f",
                     "type": "file",
-                    "dest-filename": "external/tarballs/postgresql-9.2.24.tar.bz2"
+                    "dest-filename": "external/tarballs/postgresql-13.1.tar.bz2"
                 },
                 {
                     "url": "https://dev-www.libreoffice.org/src/QR-Code-generator-1.4.0.tar.gz",


More information about the Libreoffice-commits mailing list