[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-4-1-6+backports' - 37 commits - configure.ac download.lst embeddedobj/source external/curl external/Module_external.mk external/openssl filter/source include/filter include/svx libmwaw/0001-ofz-1037-resize-vector-correctly.patch.1 libmwaw/UnpackedTarball_libmwaw.mk liborcus/0001-Prevent-infinite-loop-in-case-the-magic-number-is-no.patch.1 liborcus/0002-throw-an-exception-instead-of-asserting-on-invalid-i.patch.1 liborcus/0003-protect-the-self-closing-xml-element-code-against-se.patch.1 liborcus/UnpackedTarball_liborcus.mk lotuswordpro/source Makefile.fetch oox/Library_oox.mk openssl/ExternalPackage_openssl.mk openssl/ExternalProject_openssl.mk openssl/Makefile openssl/Module_openssl.mk openssl/openssl-asm-fix.patch openssl/opensslios.patch openssl/openssllnx.patch openssl/opensslmingw.patch openssl/opensslsol.patch openssl/opensslwnt.patch openssl/README openssl/UnpackedTarball_openssl.mk python3/ExternalPackage_python3.mk python3/i10 0492-freebsd.patch.1 python3/python-3.3.0-darwin.patch.1 python3/python-3.3.0-implicit-int.patch.1 python3/python-3.3.0-msvc-disable.patch.1 python3/python-3.3.0-msvc-x64.patch.1 python3/python-3.3.0-ssl.patch.1 python3/python-3.3.3-aix.patch.1 python3/python-3.3.3-msvc2012-winxp.patch.1 python3/python-3.3.3-py17797.patch.1 python3/python-3.3.7-c99.patch.1 python3/python-3.3.7-py30657.patch.1 python3/python-3.3.7-vcproj.patch.1 python3/python-msvc-disable-sse2.patch.1 python3/ubsan.patch.0 python3/UnpackedTarball_python3.mk RepositoryExternal.mk RepositoryModule_host.mk sc/source sd/source svx/source sw/inc sw/source tools/inc tools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Aug 18 23:50:25 UTC 2018


Rebased ref, commits from common ancestor:
commit 79f953d3352b27d4256341f74be1f4ff9a6b2588
Author:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
AuthorDate: Sat Aug 18 00:05:08 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:49:32 2018 +0200

    Go back to .bz2 - CentOS5 untar does not know .xz yet
    
    This affects zlib and Python backports
    
    Change-Id: I5d9c83f663b7d65bd045ac453e0571e53c482058

diff --git a/download.lst b/download.lst
index 33f52b13134b..36546a51a1f6 100644
--- a/download.lst
+++ b/download.lst
@@ -12,12 +12,12 @@ VISIO_MD5SUM := 82628333418f101a20cd21f980cf9f40
 export VISIO_TARBALL := libvisio-0.0.31.tar.bz2
 NSS_MD5SUM := e55ee06b22687df68fafc6a30c0554b2
 export NSS_TARBALL := nss-3.29.5-with-nspr-4.13.1.tar.gz
-ZLIB_MD5SUM := 85adef240c5f370b308da8c938951a68
-export ZLIB_TARBALL := zlib-1.2.11.tar.xz
+ZLIB_MD5SUM := f4669c4b1eb2007b208b70c96dcd4108
+export ZLIB_TARBALL := zlib-1.2.11.tar.bz2
 OPENSSL_MD5SUM := 44279b8557c3247cbe324e2322ecd114
 export OPENSSL_TARBALL := openssl-1.0.2o.tar.gz
-PYTHON_MD5SUM := 84e2f12f044ca53b577f6224c53f82ac
-export PYTHON_TARBALL := Python-3.3.7.tar.xz
+PYTHON_MD5SUM := 6c5445faa455edc76d1c8616f54a4287
+export PYTHON_TARBALL := Python-3.3.7.tar.bz2
 
 export AFMS_TARBALL := 1756c4fa6c616ae15973c104cd8cb256-Adobe-Core35_AFMs-314.tar.gz
 export APACHE_COMMONS_CODEC_TARBALL := 2e482c7567908d334785ce7d69ddfff7-commons-codec-1.6-src.tar.gz
commit 5fe825cb7ae8675cc534fd2be6c6d5448173d2d1
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 1 12:57:02 2018 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:49:31 2018 +0200

    set Referer on link mediadescriptor
    
    to allow determining if the source document is from a trusted/untrusted
    location
    
    Reviewed-on: https://gerrit.libreoffice.org/53693
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit cd25a97bbadc0a5c1fd6b0e8603c8b6ebd051926)
    
    Reviewed-on: https://gerrit.libreoffice.org/53803
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit 2d87c267267530077a94c894bc619831b01d1c04)
    
    Conflicts:
            sw/source/filter/xml/xmltexti.cxx
    
    (cherry picked from commit d7b0063c32502f01fcec72492d131760f4fda990)
    
    Conflicts:
            sw/source/filter/xml/xmltexti.cxx
    
    Change-Id: I780568652d2ef0cc8543c27ba26289277b5d9d0c

diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx
index a84f99c57a77..509acc65807c 100644
--- a/sw/source/filter/xml/xmltexti.cxx
+++ b/sw/source/filter/xml/xmltexti.cxx
@@ -572,16 +572,21 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOOoLink(
         uno::Sequence< beans::PropertyValue > aMediaDescriptor( 1 );
         aMediaDescriptor[0].Name = OUString("URL");
         aMediaDescriptor[0].Value <<= OUString( aURLObj.GetMainURL( INetURLObject::NO_DECODE ) );
-        if ( pDoc && pDoc->GetDocShell() && pDoc->GetDocShell()->GetMedium() )
+
+        if (SfxMedium* pMedium = pDoc && pDoc->GetDocShell() ? pDoc->GetDocShell()->GetMedium() : nullptr)
         {
-            uno::Reference< task::XInteractionHandler > xInteraction =
-                                        pDoc->GetDocShell()->GetMedium()->GetInteractionHandler();
+            uno::Reference< task::XInteractionHandler > xInteraction = pMedium->GetInteractionHandler();
             if ( xInteraction.is() )
             {
                 aMediaDescriptor.realloc( 2 );
                 aMediaDescriptor[1].Name = OUString( "InteractionHandler" );
                 aMediaDescriptor[1].Value <<= xInteraction;
             }
+
+            const sal_Int32 nLen = aMediaDescriptor.getLength() + 1;
+            aMediaDescriptor.realloc(nLen);
+            aMediaDescriptor[nLen - 1].Name = "Referer";
+            aMediaDescriptor[nLen - 1].Value <<= pMedium->GetName();
         }
 
         uno::Reference < embed::XEmbeddedObject > xObj(
commit 36439079dcc4d8a6f7317404351fe866fa25aec8
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun May 27 23:52:15 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:49:31 2018 +0200

    add ww6 test dir and fix a crash
    
    Change-Id: Id08176640672095c03e0b124cd65a9dce26ac2db

diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 01baf330889e..94635d8c8e90 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -4281,6 +4281,14 @@ void WW8RStyle::ImportOldFormatStyles()
     std::vector< std::vector<sal_uInt8> > aConvertedChpx;
     while (nByteCount < cbChpx)
     {
+        if (stcp == aCHPXOffsets.size())
+        {
+            //more data than style slots, skip remainder
+            rSt.SeekRel(cbChpx-nByteCount);
+            nByteCount += cbChpx-nByteCount;
+            break;
+        }
+
         sal_uInt8 cb;
         rSt >> cb;
         nByteCount++;
@@ -4303,12 +4311,7 @@ void WW8RStyle::ImportOldFormatStyles()
         else
             aConvertedChpx.push_back( std::vector<sal_uInt8>() );
 
-        stcp++;
-        if (stcp == nStyles)
-    {
-            rSt.SeekRel(cbChpx-nByteCount);
-            nByteCount += cbChpx-nByteCount;
-    }
+        ++stcp;
     }
 
     std::vector<pxoffset> aPAPXOffsets(stcp);
@@ -4318,6 +4321,12 @@ void WW8RStyle::ImportOldFormatStyles()
     stcp=0;
     while (nByteCount < cbPapx)
     {
+        if (stcp == aPAPXOffsets.size())
+        {
+            rSt.SeekRel(cbPapx-nByteCount);
+            nByteCount += cbPapx-nByteCount;
+        }
+
         sal_uInt8 cb;
         rSt >> cb;
         nByteCount++;
@@ -4339,13 +4348,7 @@ void WW8RStyle::ImportOldFormatStyles()
             nByteCount += nRemainder;
         }
 
-        stcp++;
-
-        if (stcp == nStyles)
-    {
-            rSt.SeekRel(cbPapx-nByteCount);
-            nByteCount += cbPapx-nByteCount;
-    }
+        ++stcp;
     }
 
     sal_uInt16 iMac;
commit b1f1271b5c2bb3c3a9bdd0c5602cb63f2445663f
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun May 27 23:51:33 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:49:30 2018 +0200

    fix crash on loading certain ppts
    
    Change-Id: I544a67e3706c7d12414cc075118ef2f0f5ddd0f6

diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 5c638b860fe7..e812c6d359d5 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -4058,13 +4058,13 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd
             rIn >> aTxMasterStyleHd;
             if ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom )
             {
-                sal_uInt16 nLevelAnz;
+                sal_uInt16 nLevelAnz(0);
                 rIn >> nLevelAnz;
 
                 sal_uInt16 nLev = 0;
                 sal_Bool bFirst = sal_True;
                 bFoundTxMasterStyleAtom04 = sal_True;
-                while ( rIn.GetError() == 0 && rIn.Tell() < aTxMasterStyleHd.GetRecEndFilePos() && nLev < nLevelAnz )
+                while ( rIn.GetError() == 0 && rIn.Tell() < aTxMasterStyleHd.GetRecEndFilePos() && nLev < nLevelAnz && nLev < nMaxPPTLevels)
                 {
                     if ( nLev )
                     {
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index c32b9de25556..0ad9079a3ac8 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -165,6 +165,8 @@ const sal_uInt32 PPTInventor = sal_uInt32('P') * 0x00000001
                              + sal_uInt32('T') * 0x00010000
                              + sal_uInt32('0') * 0x01000000;
 
+const int nMaxPPTLevels = 5;
+
 // Object-Ids fuer StarDraw UserData
 #define PPT_OBJECTINFO_ID       (1)
 
@@ -693,7 +695,7 @@ struct PPTExtParaLevel
 
 struct PPTExtParaSheet
 {
-    PPTExtParaLevel aExtParaLevel[ 5 ];
+    PPTExtParaLevel aExtParaLevel[nMaxPPTLevels];
 };
 
 struct PPTBuGraEntry
@@ -740,7 +742,7 @@ struct PPTCharLevel
 
 struct PPTCharSheet
 {
-    PPTCharLevel    maCharLevel[ 5 ];
+    PPTCharLevel    maCharLevel[nMaxPPTLevels];
 
                     explicit PPTCharSheet( sal_uInt32 nInstance );
                     PPTCharSheet( const PPTCharSheet& rCharSheet );
@@ -773,7 +775,7 @@ struct PPTParaSheet
 {
 public:
 
-    PPTParaLevel    maParaLevel[ 5 ];
+    PPTParaLevel    maParaLevel[nMaxPPTLevels];
 
                     explicit PPTParaSheet( sal_uInt32 nInstance );
                     PPTParaSheet( const PPTParaSheet& rParaSheet );
@@ -956,8 +958,8 @@ struct PPTRuler
 
         sal_Int32           nFlags;
         sal_uInt16          nDefaultTab;
-        sal_uInt16          nTextOfs[ 5 ];
-        sal_uInt16          nBulletOfs[ 5 ];
+        sal_uInt16          nTextOfs[nMaxPPTLevels];
+        sal_uInt16          nBulletOfs[nMaxPPTLevels];
         PPTTabEntry*        pTab;
         sal_uInt16          nTabCount;
 
commit 29aafb72f38b3bea3aeb297c75b98c5723016e0d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun May 27 23:39:50 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:49:29 2018 +0200

    ofz#372 check if ImplSplit succeeded
    
    (cherry picked from commit 62a97e6a561ce65e88d4c537a1b82c336f012722)
    (cherry picked from commit 6431e2bff67e81b4aff4e3b52e67903e1cd566f3)
    
    Reviewed-on: https://gerrit.libreoffice.org/32640
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    
    Change-Id: I1e34295fe3ee5f77e787f583616d52fa92a0eca4

diff --git a/tools/inc/poly.h b/tools/inc/poly.h
index 9f05dcc2b3e4..91ffb557a123 100644
--- a/tools/inc/poly.h
+++ b/tools/inc/poly.h
@@ -42,7 +42,7 @@ public:
 
     void            ImplSetSize( sal_uInt16 nSize, sal_Bool bResize = sal_True );
     void            ImplCreateFlagArray();
-    void            ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly = NULL );
+    bool            ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly = NULL );
 };
 
 #define MAX_POLYGONS        ((sal_uInt16)0x3FF0)
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 689f35a8f480..0c27dce9dd51 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -207,13 +207,16 @@ void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, sal_Bool bResize )
     mnPoints   = nNewSize;
 }
 
-void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly )
+bool ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly )
 {
     const sal_uIntPtr   nSpaceSize = nSpace * sizeof( Point );
 
     //Can't fit this in :-(, throw ?
     if (mnPoints + nSpace > USHRT_MAX)
-        return;
+    {
+        SAL_WARN("tools", "Polygon needs " << mnPoints + nSpace << " points, but only " << USHRT_MAX << " possible");
+        return false;
+    }
 
     const sal_uInt16    nNewSize = mnPoints + nSpace;
 
@@ -268,6 +271,8 @@ void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pI
         mpPointAry = pNewAry;
         mnPoints   = nNewSize;
     }
+
+    return true;
 }
 
 void ImplPolygon::ImplCreateFlagArray()
@@ -1467,8 +1472,8 @@ void Polygon::Insert( sal_uInt16 nPos, const Point& rPt, PolyFlags eFlags )
     if( nPos >= mpImplPolygon->mnPoints )
         nPos = mpImplPolygon->mnPoints;
 
-    mpImplPolygon->ImplSplit( nPos, 1 );
-    mpImplPolygon->mpPointAry[ nPos ] = rPt;
+    if (mpImplPolygon->ImplSplit( nPos, 1 ))
+        mpImplPolygon->mpPointAry[ nPos ] = rPt;
 
     if( POLY_NORMAL != eFlags )
     {
commit 14dd3f88f609a2a631b884d780c47401f6325bee
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun May 27 23:23:41 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:49:29 2018 +0200

    disable generation of ole previews in ODF format until after load
    
    so the user update links dialog can control their generation
    
    SdrEmbedObjectLink becomes exposed to calc so it can
    detect if the link dialog needs to be used to update
    ole links.
    
    Reviewed-on: https://gerrit.libreoffice.org/28879
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 74844277cc2194c9e43f5bd7a6f78a9603da32f3)
    
    detangle gadzillion checks into something readable
    
    no logic change intended
    
    (cherry picked from commit fad9786b06d188ba6e354620f57176f3d94a6637)
    
    Unmodified default SdrOle2Obj size is 101x101
    
    svx/source/unodraw/unoshape.cxx
    
    sets a css::awt::Size maSize to 100, 100
    
    svx/source/unodraw/unopage.cxx
    
    increases that by 1, 1
    
    awt::Size aSize = xShape->getSize();
    aSize.Width += 1;
    aSize.Height += 1;
    
    to call SdrObjFactory::MakeNewObject with 101, 101
    so default size is 101x101 (getWidth() vs GetWidth() confusion ?)
    
    Reviewed-on: https://gerrit.libreoffice.org/28895
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 7f0a219c9ad38ae33b51ff69d545f69659691c1e)
    Reviewed-on: https://gerrit.libreoffice.org/28926
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    
    Change-Id: Id1dd7ea17342140eab9307d546528747e3a98090
    b6af93afc1f80b7fc36239c96d5e0a71fcbcb789
    4d4375dff64d7b8e236d1a24322e749e04ee530f

diff --git a/embeddedobj/source/commonembedding/visobj.cxx b/embeddedobj/source/commonembedding/visobj.cxx
index 38c89fd704c3..de5af79c9894 100644
--- a/embeddedobj/source/commonembedding/visobj.cxx
+++ b/embeddedobj/source/commonembedding/visobj.cxx
@@ -182,7 +182,11 @@ embed::VisualRepresentation SAL_CALL OCommonEmbeddedObject::getPreferredVisualRe
     sal_Bool bBackToLoaded = sal_False;
     if ( m_nObjectState == embed::EmbedStates::LOADED )
     {
-        changeState( embed::EmbedStates::RUNNING );
+        awt::Size aOrigSize = getVisualAreaSize(nAspect);
+        changeState(embed::EmbedStates::RUNNING);
+        awt::Size aNewSize = getVisualAreaSize(nAspect);
+        if (aOrigSize.Width != aNewSize.Width || aOrigSize.Height != aNewSize.Height)
+            setVisualAreaSize(nAspect, aOrigSize);
 
         // the links should be switched back to loaded state for now to avoid locking problems
         bBackToLoaded = m_bIsLink;
diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx
index 36a829ebd8d3..5943e0f8682a 100644
--- a/include/svx/svdoole2.hxx
+++ b/include/svx/svdoole2.hxx
@@ -29,7 +29,9 @@
 #include <vcl/graph.hxx>
 #include <vcl/gdimtf.hxx>
 #include <sot/storage.hxx>
-#include "svx/svxdllapi.h"
+#include <svx/svxdllapi.h>
+#include <sfx2/lnkbase.hxx>
+#include <sfx2/linkmgr.hxx>
 
 //************************************************************
 //   SdrOle2Obj
@@ -192,6 +194,21 @@ public:
     virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const;
 };
 
-#endif //_SVDOOLE2_HXX
+class SVX_DLLPUBLIC SdrEmbedObjectLink : public sfx2::SvBaseLink
+{
+    SdrOle2Obj*         pObj;
+
+public:
+    explicit            SdrEmbedObjectLink(SdrOle2Obj* pObj);
+    virtual             ~SdrEmbedObjectLink();
+
+    virtual void        Closed() override;
+    virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
+        const String& rMimeType, const css::uno::Any & rValue ) override;
+
+    bool                Connect() { return GetRealObject() != nullptr; }
+};
+
+#endif // INCLUDED_SVX_SVDOOLE2_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 5009ee03f583..52cbf7786c6c 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -544,6 +544,9 @@ sal_Bool ScDocShell::Load( SfxMedium& rMedium )
     sal_Bool bRet = SfxObjectShell::Load( rMedium );
     if( bRet )
     {
+        comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer();
+        rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false);
+
         if (GetMedium())
         {
             SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, false);
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index d778e7823ee0..4d9ab8313b6b 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -29,6 +29,7 @@ using namespace ::com::sun::star;
 
 #include "scitems.hxx"
 #include <sfx2/fcontnr.hxx>
+#include <sfx2/linkmgr.hxx>
 #include <sfx2/objface.hxx>
 #include <sfx2/docfile.hxx>
 #include <svtools/ehdl.hxx>
@@ -42,6 +43,7 @@ using namespace ::com::sun::star;
 #include <svx/drawitem.hxx>
 #include <svx/fmshell.hxx>
 #include <svtools/xwindowitem.hxx>
+#include <svx/svdoole2.hxx>
 #include <sfx2/passwd.hxx>
 #include <sfx2/filedlghelper.hxx>
 #include <sfx2/dispatch.hxx>
@@ -415,6 +417,8 @@ void ScDocShell::Execute( SfxRequest& rReq )
         case SID_UPDATETABLINKS:
             {
                 ScDocument* pDoc = GetDocument();
+                comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer();
+                rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true);
 
                 ScLkUpdMode nSet=pDoc->GetLinkMode();
 
@@ -463,7 +467,10 @@ void ScDocShell::Execute( SfxRequest& rReq )
                     rReq.Done();
                 }
                 else
+                {
+                    rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false);
                     rReq.Ignore();
+                }
             }
             break;
 
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 2dd69a9fdec0..5cf3d4a583d5 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -683,6 +683,12 @@ void SdDrawDocument::UpdateAllLinks()
     {
         pDocLockedInsertingLinks = this; // lock inserting links. only links in this document should by resolved
 
+        if (mpDocSh)
+        {
+            comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = mpDocSh->getEmbeddedObjectContainer();
+            rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true);
+        }
+
         pLinkManager->UpdateAllLinks();  // query box: update all links?
 
         if( pDocLockedInsertingLinks == this )
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 9c998a33a4d7..a4cd65058070 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -291,8 +291,11 @@ sal_Bool DrawDocShell::Load( SfxMedium& rMedium )
     }
 
     bRet = SfxObjectShell::Load( rMedium );
-    if( bRet )
+    if(bRet)
     {
+        comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer();
+        rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false);
+
         bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( rMedium.GetStorage() ) ).Import( nError );
     }
 
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 89e4e3d81c67..f361fc822634 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -56,7 +56,6 @@
 #include <comphelper/classids.hxx>
 
 #include <sot/formats.hxx>
-#include <sfx2/linkmgr.hxx>
 #include <svtools/transfer.hxx>
 #include <cppuhelper/implbase5.hxx>
 
@@ -591,25 +590,6 @@ void SdrLightEmbeddedClient_Impl::setWindow(const uno::Reference< awt::XWindow >
     m_xWindow = _xWindow;
 }
 
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class SdrEmbedObjectLink : public sfx2::SvBaseLink
-{
-    SdrOle2Obj*         pObj;
-
-public:
-                        SdrEmbedObjectLink(SdrOle2Obj* pObj);
-    virtual             ~SdrEmbedObjectLink();
-
-    virtual void        Closed();
-    virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
-        const String& rMimeType, const ::com::sun::star::uno::Any & rValue );
-
-    bool                Connect() { return GetRealObject() != NULL; }
-};
-
-// -----------------------------------------------------------------------------
-
 SdrEmbedObjectLink::SdrEmbedObjectLink(SdrOle2Obj* pObject):
     ::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, SOT_FORMATSTR_ID_SVXB ),
     pObj(pObject)
diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx
index 59b8b59ac43b..6db82753fe3b 100644
--- a/svx/source/unodraw/unoshap4.cxx
+++ b/svx/source/unodraw/unoshap4.cxx
@@ -408,7 +408,7 @@ sal_Bool SvxOle2Shape::createObject( const SvGlobalName &aClassName )
     if( xObj.is() )
     {
         Rectangle aRect = pOle2Obj->GetLogicRect();
-        if ( aRect.GetWidth() == 100 && aRect.GetHeight() == 100 )
+        if ( aRect.GetWidth() == 101 && aRect.GetHeight() == 101 )
         {
             // TODO/LATER: is it possible that this method is used to create an iconified object?
             // default size
@@ -472,7 +472,7 @@ sal_Bool SvxOle2Shape::createLink( const OUString& aLinkURL )
     if( xObj.is() )
     {
         Rectangle aRect = pOle2Obj->GetLogicRect();
-        if ( aRect.GetWidth() == 100 && aRect.GetHeight() == 100 )
+        if ( aRect.GetWidth() == 101 && aRect.GetHeight() == 101 )
         {
             // default size
             try
diff --git a/sw/inc/IDocumentLinksAdministration.hxx b/sw/inc/IDocumentLinksAdministration.hxx
index a4c5a6aee1e0..d80f7861e696 100644
--- a/sw/inc/IDocumentLinksAdministration.hxx
+++ b/sw/inc/IDocumentLinksAdministration.hxx
@@ -44,7 +44,7 @@ namespace sfx2 { class SvLinkSource;  class LinkManager; }
     /** #i42634# Moved common code of SwReader::Read() and
         SwDocShell::UpdateLinks() to new SwDoc::UpdateLinks():
     */
-    virtual void UpdateLinks(bool bUI) = 0;
+    virtual void UpdateLinks() = 0;
 
     /** SS fuers Linken von Dokumentteilen  / ?? for linking of parts of documents.
     */
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index fc258ef8ac21..e2efb9e868ca 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -794,7 +794,7 @@ public:
     virtual void SetVisibleLinks(bool bFlag);
     virtual sfx2::LinkManager& GetLinkManager();
     virtual const sfx2::LinkManager& GetLinkManager() const;
-    virtual void UpdateLinks(bool bUI);
+    virtual void UpdateLinks();
     virtual bool GetData(const OUString& rItem, const String& rMimeType, ::com::sun::star::uno::Any& rValue) const;
     virtual bool SetData(const OUString& rItem, const String& rMimeType, const ::com::sun::star::uno::Any& rValue);
     virtual ::sfx2::SvLinkSource* CreateLinkSource(const OUString& rItem);
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 93525caf1c1e..7a586efc6179 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -946,56 +946,59 @@ IGrammarContact* getGrammarContact( const SwTxtNode& rTxtNode )
 
 // #i42634# Moved common code of SwReader::Read() and SwDocShell::UpdateLinks()
 // to new SwDoc::UpdateLinks():
-void SwDoc::UpdateLinks( bool bUI )
+void SwDoc::UpdateLinks( )
 {
-    SfxObjectCreateMode eMode;
-    sal_uInt16 nLinkMode = getLinkUpdateMode( true );
-    if ( GetDocShell()) {
-        sal_uInt16 nUpdateDocMode = GetDocShell()->GetUpdateDocMode();
-        if( (nLinkMode != NEVER ||  document::UpdateDocMode::FULL_UPDATE == nUpdateDocMode) &&
-            !GetLinkManager().GetLinks().empty() &&
-            SFX_CREATE_MODE_INTERNAL !=
-                        ( eMode = GetDocShell()->GetCreateMode()) &&
-            SFX_CREATE_MODE_ORGANIZER != eMode &&
-            SFX_CREATE_MODE_PREVIEW != eMode &&
-            !GetDocShell()->IsPreview() )
-        {
-            ViewShell* pVSh = 0;
-            bool bAskUpdate = nLinkMode == MANUAL;
-            bool bUpdate = true;
-            switch(nUpdateDocMode)
-            {
-                case document::UpdateDocMode::NO_UPDATE:   bUpdate = false;break;
-                case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = false; break;
-                case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = true; break;
-            }
-            if (nLinkMode == AUTOMATIC && !bAskUpdate)
-            {
-                SfxMedium * medium = GetDocShell()->GetMedium();
-                if (!SvtSecurityOptions().isTrustedLocationUriForUpdatingLinks(
-                        medium == nullptr ? OUString() : medium->GetName()))
-                {
-                    bAskUpdate = true;
-                }
-            }
-            if( bUpdate && (bUI || !bAskUpdate) )
-            {
-                SfxMedium* pMedium = GetDocShell()->GetMedium();
-                SfxFrame* pFrm = pMedium ? pMedium->GetLoadTargetFrame() : 0;
-                Window* pDlgParent = pFrm ? &pFrm->GetWindow() : 0;
-                if( GetCurrentViewShell() && !GetEditShell( &pVSh ) && !pVSh )  //swmod 071108//swmod 071225
-                {
-                    ViewShell aVSh( *this, 0, 0 );
-
-                    SET_CURR_SHELL( &aVSh );
-                    GetLinkManager().UpdateAllLinks( bAskUpdate , true, false, pDlgParent );
-                }
-                else
-                    GetLinkManager().UpdateAllLinks( bAskUpdate, true, false, pDlgParent );
-            }
-        }
-    }
-
+     if (!GetDocShell())
+         return;
+     SfxObjectCreateMode eMode = GetDocShell()->GetCreateMode();
+     if (eMode == SfxObjectCreateMode::SFX_CREATE_MODE_INTERNAL)
+         return;
+     if (eMode == SfxObjectCreateMode::SFX_CREATE_MODE_ORGANIZER)
+         return;
+     if (eMode == SfxObjectCreateMode::SFX_CREATE_MODE_PREVIEW)
+         return;
+     if (GetDocShell()->IsPreview())
+         return;
+     if (GetLinkManager().GetLinks().empty())
+         return;
+     sal_uInt16 nLinkMode = getLinkUpdateMode(true);
+     sal_uInt16 nUpdateDocMode = GetDocShell()->GetUpdateDocMode();
+     if (nLinkMode == NEVER && nUpdateDocMode != document::UpdateDocMode::FULL_UPDATE)
+         return;
+
+     bool bAskUpdate = nLinkMode == MANUAL;
+     bool bUpdate = true;
+     switch(nUpdateDocMode)
+     {
+         case document::UpdateDocMode::NO_UPDATE:   bUpdate = false;break;
+         case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = false; break;
+         case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = true; break;
+     }
+     if (nLinkMode == AUTOMATIC && !bAskUpdate)
+     {
+         SfxMedium * medium = GetDocShell()->GetMedium();
+         if (!SvtSecurityOptions().isTrustedLocationUriForUpdatingLinks(
+                 medium == nullptr ? OUString() : medium->GetName()))
+         {
+             bAskUpdate = true;
+         }
+     }
+     comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = GetDocShell()->getEmbeddedObjectContainer();
+     if (bUpdate)
+     {
+         rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true);
+
+         SfxMedium* pMedium = GetDocShell()->GetMedium();
+         SfxFrame* pFrame = pMedium ? pMedium->GetLoadTargetFrame() : nullptr;
+
+         Window* pDlgParent = pFrame ? &pFrame->GetWindow() : nullptr;
+
+         GetLinkManager().UpdateAllLinks( bAskUpdate, true, false, pDlgParent );
+     }
+     else
+     {
+         rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false);
+     }
 }
 
 ::sfx2::IXmlIdRegistry&
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 0e70a2d1889d..ef9774ea152d 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -368,7 +368,8 @@ sal_uLong SwReader::Read( const Reader& rOptions )
         // #i42634# Moved common code of SwReader::Read() and
         // SwDocShell::UpdateLinks() to new SwDoc::UpdateLinks():
     // ATM still with Update
-        pDoc->UpdateLinks( true );
+        //pDoc->getIDocumentLinksAdministration().UpdateLinks();
+        pDoc->UpdateLinks();
 
         // not insert: set the redline mode read from settings.xml
         eOld = static_cast<RedlineMode_t>(
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx
index 4a1aa27a03bf..30014092bf82 100644
--- a/sw/source/ui/app/docsh.cxx
+++ b/sw/source/ui/app/docsh.cxx
@@ -1164,7 +1164,7 @@ void SwDocShell::CalcLayoutForOLEObjects()
 // read by the binary filter:
 void SwDocShell::UpdateLinks()
 {
-    GetDoc()->UpdateLinks(true);
+    GetDoc()->UpdateLinks();
     // #i50703# Update footnote numbers
     SwTxtFtn::SetUniqueSeqRefNo( *GetDoc() );
     SwNodeIndex aTmp( GetDoc()->GetNodes() );
commit baafec35f243b26e80c1ea389509fb237a80135c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun May 27 17:04:50 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:49:28 2018 +0200

    [PATCH] guard against corrupt m_nNumTabs
    
    Includes:
     - guard against corrupt LwpTocSuperLayout
     - guard against corrupt SilverBullet
     - guard against corrupt ObjIndexData
    
    Change-Id: I41b8514a127d463ac951e5855f09416fa0456b1b

diff --git a/lotuswordpro/source/filter/lwpidxmgr.cxx b/lotuswordpro/source/filter/lwpidxmgr.cxx
index ccd2c388a612..4a23c2980458 100644
--- a/lotuswordpro/source/filter/lwpidxmgr.cxx
+++ b/lotuswordpro/source/filter/lwpidxmgr.cxx
@@ -155,7 +155,10 @@ void LwpIndexManager::ReadRootData(LwpObjectStream* pObjStrm)
     sal_uInt16 KeyCount = pObjStrm->QuickReaduInt16();
     m_nLeafCount = KeyCount ? KeyCount + 1 : 0;
 
-    if(KeyCount)
+    if (m_nLeafCount > SAL_N_ELEMENTS(m_ChildIndex))
+        throw std::range_error("corrupt RootData");
+
+    if (KeyCount)
     {
         //read object keys
         LwpKey* akey = new LwpKey();
@@ -215,7 +218,7 @@ void LwpIndexManager::ReadObjIndexData(LwpObjectStream* pObjStrm)
             vObjIndexs[k]->offset = pObjStrm->QuickReaduInt32();
 
         for (k = 0; k < LeafCount; k++)
-            m_TempVec[k] = pObjStrm->QuickReaduInt32();
+            m_TempVec.at(k) = pObjStrm->QuickReaduInt32();
     }
 
     for( sal_uInt16 j=0; j<LeafCount; j++ )
diff --git a/lotuswordpro/source/filter/lwpobjstrm.cxx b/lotuswordpro/source/filter/lwpobjstrm.cxx
index b9dc3926eaad..0de01a5c647b 100644
--- a/lotuswordpro/source/filter/lwpobjstrm.cxx
+++ b/lotuswordpro/source/filter/lwpobjstrm.cxx
@@ -170,7 +170,7 @@ sal_uInt16 LwpObjectStream::QuickRead(void* buf, sal_uInt16 len)
     memset(buf, 0, len);
     if( len > m_nBufSize - m_nReadPos )
     {
-        assert(false);
+        SAL_WARN("lwp", "read request longer than buffer");
         len = m_nBufSize - m_nReadPos;
     }
     if( m_pContentBuf && len)
diff --git a/lotuswordpro/source/filter/lwpsilverbullet.cxx b/lotuswordpro/source/filter/lwpsilverbullet.cxx
index 27dedc073512..51734ee0bbce 100644
--- a/lotuswordpro/source/filter/lwpsilverbullet.cxx
+++ b/lotuswordpro/source/filter/lwpsilverbullet.cxx
@@ -93,7 +93,10 @@ void LwpSilverBullet::Read()
 
     sal_uInt16 nNumPos = m_pObjStrm->QuickReaduInt16();
 
-    for (sal_uInt8 nC = 0; nC < nNumPos; nC++)
+    if (nNumPos > SAL_N_ELEMENTS(m_pResetPositionFlags))
+        throw std::range_error("corrupt SilverBullet");
+
+    for (sal_uInt16 nC = 0; nC < nNumPos; nC++)
         m_pResetPositionFlags[nC] = m_pObjStrm->QuickReaduInt8();
 
     m_nUseCount = m_pObjStrm->QuickReaduInt32();
diff --git a/lotuswordpro/source/filter/lwptabrack.cxx b/lotuswordpro/source/filter/lwptabrack.cxx
index 32f229949e56..87a91d233047 100644
--- a/lotuswordpro/source/filter/lwptabrack.cxx
+++ b/lotuswordpro/source/filter/lwptabrack.cxx
@@ -87,11 +87,12 @@ LwpTabRack::LwpTabRack(LwpObjectHeader objHdr, LwpSvStream* pStrm):LwpObject(obj
 
 void LwpTabRack::Read()
 {
-//  LwpObjectID     m_NextID;
     m_NextID.ReadIndexed(m_pObjStrm);
 
     m_nNumTabs = m_pObjStrm->QuickReaduInt16();
-    for( int i=0; i<m_nNumTabs; i++ )
+    if (m_nNumTabs > MaxTabs)
+        throw std::range_error("corrupt LwpTabRack");
+    for (int i=0; i<m_nNumTabs; ++i)
     {
         m_aTabs[i].Read(m_pObjStrm);
         m_pObjStrm->SkipExtra();
diff --git a/lotuswordpro/source/filter/lwptoc.cxx b/lotuswordpro/source/filter/lwptoc.cxx
index ef4af4549ca3..6b055d4ed30d 100644
--- a/lotuswordpro/source/filter/lwptoc.cxx
+++ b/lotuswordpro/source/filter/lwptoc.cxx
@@ -101,17 +101,22 @@ void LwpTocSuperLayout::Read()
 
     m_SearchItems.Read(m_pObjStrm);
 
-    sal_uInt16 i;
     sal_uInt16 count = m_pObjStrm->QuickReaduInt16();
-    for (i = 0; (i < MAX_LEVELS) && (count > 0); i++, count--)
+    if (count > MAX_LEVELS)
+        throw std::range_error("corrupt LwpTocSuperLayout");
+    for (sal_uInt16 i = 0; i < count; ++i)
         m_DestName[i].Read(m_pObjStrm);
 
     count = m_pObjStrm->QuickReaduInt16();
-    for (i = 0; (i < MAX_LEVELS) && (count > 0); i++, count--)
+    if (count > MAX_LEVELS)
+        throw std::range_error("corrupt LwpTocSuperLayout");
+    for (sal_uInt16 i = 0; i < count; ++i)
         m_DestPGName[i].Read(m_pObjStrm);
 
     count = m_pObjStrm->QuickReaduInt16();
-    for (i = 0; i < count; i++)
+    if (count > MAX_LEVELS)
+        throw std::range_error("corrupt LwpTocSuperLayout");
+    for (sal_uInt16 i = 0; i < count; ++i)
         m_nFlags[i] = m_pObjStrm->QuickReaduInt32();
 
     m_pObjStrm->SkipExtra();
commit 01f1434e3182746abf333f54f4fca21402d7a71d
Author:     David Tardon <dtardon at redhat.com>
AuthorDate: Fri Aug 17 16:35:11 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:49:28 2018 +0200

    use correct size
    
    (cherry picked from commit d1ae31a1fc49ec7a68b2a07c5e5e97d95b346ca9)
    
    Reviewed-on: https://gerrit.libreoffice.org/38827
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>
    (cherry picked from commit 54e7b46718bf2f47c7f55a93cfbb23681429ffc6)
    
    Change-Id: I620ada9b209bb2084eccaa81385beb6306d6a3d0

diff --git a/libmwaw/0001-ofz-1037-resize-vector-correctly.patch.1 b/libmwaw/0001-ofz-1037-resize-vector-correctly.patch.1
new file mode 100644
index 000000000000..44095ad6ec99
--- /dev/null
+++ b/libmwaw/0001-ofz-1037-resize-vector-correctly.patch.1
@@ -0,0 +1,25 @@
+From 68b3b74569881248bfb6cbb4266177cc253b292f Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Sat, 8 Apr 2017 14:03:29 +0200
+Subject: [PATCH] ofz#1037 resize vector correctly
+
+---
+ src/lib/MsWrd1Parser.cxx | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/lib/MsWrd1Parser.cxx b/src/lib/MsWrd1Parser.cxx
+index 63547e6..3626064 100644
+--- a/src/lib/MSW1Parser.cxx
++++ b/src/lib/MSW1Parser.cxx
+@@ -902,7 +902,7 @@ bool MsWrd1Parser::readFootnoteCorrespondance(MWAWVec2i limits)
+     int id = fIt++->second;
+     fPos[1] = fIt==footnoteMap.end() ? m_state->m_eot : fIt->first;
+     if (id >= int(m_state->m_footnotesList.size()))
+-      m_state->m_footnotesList.resize(size_t(id),0);
++      m_state->m_footnotesList.resize(size_t(id)+1,0);
+     m_state->m_footnotesList[size_t(id)]=fPos;
+   }
+   ascii().addDelimiter(input->tell(),'|');
+-- 
+2.13.0
+
diff --git a/libmwaw/UnpackedTarball_libmwaw.mk b/libmwaw/UnpackedTarball_libmwaw.mk
index 96fe9df6afa0..f897f708c9aa 100644
--- a/libmwaw/UnpackedTarball_libmwaw.mk
+++ b/libmwaw/UnpackedTarball_libmwaw.mk
@@ -11,4 +11,8 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,libmwaw))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,libmwaw,$(MWAW_TARBALL)))
 
+$(eval $(call gb_UnpackedTarball_add_patches,libmwaw, \
+	libmwaw/0001-ofz-1037-resize-vector-correctly.patch.1 \
+))
+
 # vim: set noet sw=4 ts=4:
commit 77102df29789993bad01392e4b285fed865e98be
Author:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
AuthorDate: Fri Aug 17 15:36:07 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:49:27 2018 +0200

    liborcus: backport fixes from upstream
    
    Since we're stuck functionally to the 0.5.x version here, backport
    relevant fixes from the upstream project
    
    Change-Id: I1531682ec3ec7a22d4cf721fc7bf85a57073ca8e

diff --git a/liborcus/0001-Prevent-infinite-loop-in-case-the-magic-number-is-no.patch.1 b/liborcus/0001-Prevent-infinite-loop-in-case-the-magic-number-is-no.patch.1
new file mode 100644
index 000000000000..9b18008ba959
--- /dev/null
+++ b/liborcus/0001-Prevent-infinite-loop-in-case-the-magic-number-is-no.patch.1
@@ -0,0 +1,27 @@
+From 8c8cdc53438a46d6f0c889b987353ec82cbe0ea2 Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yoshida at gmail.com>
+Date: Sun, 1 Sep 2013 22:28:35 -0400
+Subject: [PATCH 1/3] Prevent infinite loop in case the magic number is not
+ found.
+
+(cherry picked from commit b554e16c154b6bf9e64ecc883e134cf5c2301b6f)
+---
+ src/parser/zip_archive.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/parser/zip_archive.cpp b/src/parser/zip_archive.cpp
+index e244908b..2e4f5885 100644
+--- a/src/parser/zip_archive.cpp
++++ b/src/parser/zip_archive.cpp
+@@ -529,7 +529,7 @@ size_t zip_archive_impl::seek_central_dir()
+     // Read stream backward and try to find the magic number.
+ 
+     size_t read_end_pos = m_stream_size;
+-    while (true)
++    while (read_end_pos)
+     {
+         if (read_end_pos < buf.size())
+             // Last segment to read.
+-- 
+2.13.7
+
diff --git a/liborcus/0002-throw-an-exception-instead-of-asserting-on-invalid-i.patch.1 b/liborcus/0002-throw-an-exception-instead-of-asserting-on-invalid-i.patch.1
new file mode 100644
index 000000000000..dca4d5fe1ff5
--- /dev/null
+++ b/liborcus/0002-throw-an-exception-instead-of-asserting-on-invalid-i.patch.1
@@ -0,0 +1,30 @@
+From 704dc974685d0c4c7fe41c1551078a2208ba07bd Mon Sep 17 00:00:00 2001
+From: Markus Mohrhard <markus.mohrhard at googlemail.com>
+Date: Fri, 23 Dec 2016 01:37:45 +0100
+Subject: [PATCH 2/3] throw an exception instead of asserting on invalid input
+
+This was found by afl.
+
+(cherry picked from commit 43805da3c4168ff24b0e6b82041fbe58dc8b4e6d)
+---
+ include/orcus/csv_parser.hpp | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/include/orcus/csv_parser.hpp b/include/orcus/csv_parser.hpp
+index 3f80da0e..271f0248 100644
+--- a/include/orcus/csv_parser.hpp
++++ b/include/orcus/csv_parser.hpp
+@@ -192,7 +192,9 @@ void csv_parser<_Handler>::row()
+             return;
+         }
+ 
+-        assert(is_delim(c));
++        if (is_delim(c))
++            throw csv_parse_error("expected a delimiter");
++
+         next();
+ 
+         if (m_config.trim_cell_value)
+-- 
+2.13.7
+
diff --git a/liborcus/0003-protect-the-self-closing-xml-element-code-against-se.patch.1 b/liborcus/0003-protect-the-self-closing-xml-element-code-against-se.patch.1
new file mode 100644
index 000000000000..818c01d369cc
--- /dev/null
+++ b/liborcus/0003-protect-the-self-closing-xml-element-code-against-se.patch.1
@@ -0,0 +1,35 @@
+From 1dcaea9757edd06e0293c4abeea49884e70f09c5 Mon Sep 17 00:00:00 2001
+From: Markus Mohrhard <markus.mohrhard at googlemail.com>
+Date: Wed, 21 Feb 2018 00:29:03 +0100
+Subject: [PATCH 3/3] protect the self-closing xml element code against
+ self-closing root elements
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Found by Antti Levomäki and Christian Jalio from Forcepoint.
+
+(cherry picked from commit 12e5d89cbd7101c61fbdf063322203a1590a0ef5)
+
+Conflicts:
+	include/orcus/sax_parser.hpp
+---
+ include/orcus/sax_parser.hpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/orcus/sax_parser.hpp b/include/orcus/sax_parser.hpp
+index aa74364e..53c33490 100644
+--- a/include/orcus/sax_parser.hpp
++++ b/include/orcus/sax_parser.hpp
+@@ -312,6 +312,8 @@ void sax_parser<_Handler>::element_open(const char* begin_pos)
+             elem.end_pos = m_char;
+             m_handler.start_element(elem);
+             m_handler.end_element(elem);
++            if (!m_nest_level)
++                m_root_elem_open = false;
+             return;
+         }
+         else if (c == '>')
+-- 
+2.13.7
+
diff --git a/liborcus/UnpackedTarball_liborcus.mk b/liborcus/UnpackedTarball_liborcus.mk
index 062999d2f92c..5f8412bea230 100644
--- a/liborcus/UnpackedTarball_liborcus.mk
+++ b/liborcus/UnpackedTarball_liborcus.mk
@@ -24,6 +24,11 @@ liborcus_patches += liborcus_0.1.0-dllimport.patch
 # fdo#63844
 liborcus_patches += liborcus-handle-invalid-xml.patch.1
 
+# backports
+liborcus_patches += 0001-Prevent-infinite-loop-in-case-the-magic-number-is-no.patch.1
+liborcus_patches += 0002-throw-an-exception-instead-of-asserting-on-invalid-i.patch.1
+liborcus_patches += 0003-protect-the-self-closing-xml-element-code-against-se.patch.1
+
 ifeq ($(OS),MACOSX)
 # no "tac" command on OS X, but "tail -r"
 liborcus_patches += liborcus_0.1.0-tac.patch
commit 839e48b4ddc6c1675a15b2262db915f26120b763
Author:     Thorsten Behrens <thorsten.behrens at cib.de>
AuthorDate: Thu Aug 16 17:17:41 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:48:26 2018 +0200

    python3: fix misc platform issues
    
     - fix msbuild files for vs2012
     - fix micro version
     - deliver versioned libpython3.3m.so.1.0
    
    Change-Id: I41846893443e48f3859c78f09cdae4b5a6d0975a

diff --git a/configure.ac b/configure.ac
index fa97cbbf812f..9a00927f2774 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7610,7 +7610,7 @@ internal)
     SYSTEM_PYTHON=NO
     PYTHON_VERSION_MAJOR=3
     PYTHON_VERSION_MINOR=3
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.3
+    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
     BUILD_TYPE="$BUILD_TYPE PYTHON"
     # Embedded Python dies without Home set
     if test "$HOME" = ""; then
diff --git a/python3/ExternalPackage_python3.mk b/python3/ExternalPackage_python3.mk
index 3cd212663347..3a36d4e33fde 100644
--- a/python3/ExternalPackage_python3.mk
+++ b/python3/ExternalPackage_python3.mk
@@ -46,8 +46,9 @@ else
 $(eval $(call gb_ExternalPackage_add_file,python3,$(gb_Package_PROGRAMDIRNAME)/python.bin,python))
 $(eval $(call gb_ExternalPackage_add_file,python3,$(gb_Package_PROGRAMDIRNAME)/libpython$(PYTHON_VERSION_MAJOR).so,libpython$(PYTHON_VERSION_MAJOR).so))
 $(eval $(call gb_ExternalPackage_add_file,python3,$(gb_Package_PROGRAMDIRNAME)/libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so,libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so))
+# versioned lib/libpython3.3m.so.1.0 appears to be necessary?
+$(eval $(call gb_ExternalPackage_add_file,python3,$(gb_Package_PROGRAMDIRNAME)/libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so.1.0,libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so.1.0))
 $(eval $(call gb_ExternalPackage_add_file,python3,$(gb_Package_PROGRAMDIRNAME)/libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so-gdb.py,Tools/gdb/libpython.py))
-# versioned lib/libpython3.3m.so.1.0 appears to be unnecessary?
 
 # Unfortunately the python build system does not allow to explicitly enable or
 # disable these, it just tries to build them and then prints which did not
diff --git a/python3/UnpackedTarball_python3.mk b/python3/UnpackedTarball_python3.mk
index 24bfaa673b5f..901012640770 100644
--- a/python3/UnpackedTarball_python3.mk
+++ b/python3/UnpackedTarball_python3.mk
@@ -28,6 +28,8 @@ $(eval $(call gb_UnpackedTarball_add_patches,python3,\
 	python3/python-msvc-disable-sse2.patch.1 \
 	python3/ubsan.patch.0 \
 	python3/python-3.3.7-py30657.patch.1 \
+	python3/python-3.3.7-c99.patch.1 \
+	python3/python-3.3.7-vcproj.patch.1 \
 ))
 
 ifneq ($(filter DRAGONFLY FREEBSD LINUX NETBSD OPENBSD SOLARIS,$(OS)),)
diff --git a/python3/python-3.3.7-c99.patch.1 b/python3/python-3.3.7-c99.patch.1
new file mode 100644
index 000000000000..8cdf03458fc9
--- /dev/null
+++ b/python3/python-3.3.7-c99.patch.1
@@ -0,0 +1,38 @@
+--- python3/Modules/expat/xmltok.c~	2017-09-19 09:32:02.000000000 +0200
++++ python3/Modules/expat/xmltok.c	2018-08-16 14:09:32.350949800 +0200
+@@ -31,7 +31,12 @@
+ */
+ 
+ #include <stddef.h>
+-#include <stdbool.h>
++
++//#include <stdbool.h>
++typedef int bool;
++#define false 0
++#define true 1
++
+ #include <string.h>  // memcpy
+ 
+ #ifdef _WIN32
+@@ -404,6 +409,7 @@
+     output_exhausted = true;
+   }
+ 
++  {
+   /* Avoid copying partial characters (from incomplete input). */
+   const char * const fromLimBefore = fromLim;
+   align_limit_to_full_utf8_characters(*fromP, &fromLim);
+@@ -411,10 +417,13 @@
+     input_incomplete = true;
+   }
+ 
++  {
+   const ptrdiff_t bytesToCopy = fromLim - *fromP;
+   memcpy((void *)*toP, (const void *)*fromP, (size_t)bytesToCopy);
+   *fromP += bytesToCopy;
+   *toP += bytesToCopy;
++  }
++  }
+ 
+   if (output_exhausted)  // needs to go first
+     return XML_CONVERT_OUTPUT_EXHAUSTED;
diff --git a/python3/python-3.3.7-vcproj.patch.1 b/python3/python-3.3.7-vcproj.patch.1
new file mode 100644
index 000000000000..9a9bf06bd90a
--- /dev/null
+++ b/python3/python-3.3.7-vcproj.patch.1
@@ -0,0 +1,20 @@
+--- python3/PCbuild/pyexpat.vcxproj~	2017-09-19 09:32:02.000000000 +0200
++++ python3/PCbuild/pyexpat.vcxproj	2018-08-16 18:45:44.202252500 +0200
+@@ -222,6 +222,7 @@
+   <ItemGroup>
+     <ClCompile Include="..\Modules\pyexpat.c" />
+     <ClCompile Include="..\Modules\expat\xmlparse.c" />
++    <ClCompile Include="..\Modules\expat\loadlibrary.c" />
+     <ClCompile Include="..\Modules\expat\xmlrole.c" />
+     <ClCompile Include="..\Modules\expat\xmltok.c" />
+   </ItemGroup>
+--- python3/PCbuild/_elementtree.vcxproj~	2017-09-19 09:32:02.000000000 +0200
++++ python3/PCbuild/_elementtree.vcxproj	2018-08-16 19:21:43.515980500 +0200
+@@ -254,6 +254,7 @@
+   </ItemGroup>
+   <ItemGroup>
+     <ClCompile Include="..\Modules\_elementtree.c" />
++    <ClCompile Include="..\Modules\expat\loadlibrary.c" />
+     <ClCompile Include="..\Modules\expat\xmlparse.c" />
+     <ClCompile Include="..\Modules\expat\xmlrole.c" />
+     <ClCompile Include="..\Modules\expat\xmltok.c" />
commit 63597edcf8b84380e3fbb32e728b970fbe08823d
Author:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
AuthorDate: Thu Aug 16 15:36:26 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:48:24 2018 +0200

    python3: Check & prevent integer overflow in PyString_DecodeEscape
    
    Backport from upstream 3.4 / bpo-30657: Fix CVE-2017-1000158
    
    Change-Id: Ic978f7623231ec7e7ca5de992762b17b597ee675

diff --git a/python3/UnpackedTarball_python3.mk b/python3/UnpackedTarball_python3.mk
index d012860afb1a..24bfaa673b5f 100644
--- a/python3/UnpackedTarball_python3.mk
+++ b/python3/UnpackedTarball_python3.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,python3,\
 	python3/python-3.3.3-msvc2012-winxp.patch.1 \
 	python3/python-msvc-disable-sse2.patch.1 \
 	python3/ubsan.patch.0 \
+	python3/python-3.3.7-py30657.patch.1 \
 ))
 
 ifneq ($(filter DRAGONFLY FREEBSD LINUX NETBSD OPENBSD SOLARIS,$(OS)),)
diff --git a/python3/python-3.3.7-py30657.patch.1 b/python3/python-3.3.7-py30657.patch.1
new file mode 100644
index 000000000000..a9d24320f9f6
--- /dev/null
+++ b/python3/python-3.3.7-py30657.patch.1
@@ -0,0 +1,19 @@
+diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
+index 27f406947208..08c91a265adc 100644
+--- a/Objects/bytesobject.c
++++ b/Objects/bytesobject.c
+@@ -368,7 +368,13 @@ PyObject *PyBytes_DecodeEscape(const char *s,
+     char *p, *buf;
+     const char *end;
+     PyObject *v;
+-    Py_ssize_t newlen = recode_encoding ? 4*len:len;
++    Py_ssize_t newlen;
++    /* Check for integer overflow */
++    if (recode_encoding && (len > PY_SSIZE_T_MAX / 4)) {
++        PyErr_SetString(PyExc_OverflowError, "string is too large");
++        return NULL;
++    }
++    newlen = recode_encoding ? 4*len:len;
+     v = PyBytes_FromStringAndSize((char *)NULL, newlen);
+     if (v == NULL)
+         return NULL;
commit ac2891cdd2b1740d60701ee83b3057626099a028
Author:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
AuthorDate: Thu Aug 16 15:23:33 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:48:24 2018 +0200

    python3: update various patches
    
    - take python-3.3.3-msvc2012-winxp.patch.1 from 6.0
    - take python-msvc-disable-sse2.patch.1 from 6.0
    - take ubsan.patch.0 from 6.0 - longobject.c and listobject.c
      bits apparently fixed upstream already
    - update python-3.3.3-py17797.patch.1 from 6.0
    
    Plus remove obsolete VS2008 support, this is cherry-picked from
    4ce1cec2a4c98451b8b686f6f7a114a6927f0cae
    
    Change-Id: I1a37e92e9e06a9e66efe6d39234fbe19c2c0c2c6

diff --git a/python3/UnpackedTarball_python3.mk b/python3/UnpackedTarball_python3.mk
index 90f1f68d0a98..d012860afb1a 100644
--- a/python3/UnpackedTarball_python3.mk
+++ b/python3/UnpackedTarball_python3.mk
@@ -24,6 +24,9 @@ $(eval $(call gb_UnpackedTarball_add_patches,python3,\
 	python3/python-3.3.0-gcc-4.8.patch.1 \
 	python3/python-3.3.0-pythreadstate.patch.1 \
 	python3/python-3.3.3-py17797.patch.1 \
+	python3/python-3.3.3-msvc2012-winxp.patch.1 \
+	python3/python-msvc-disable-sse2.patch.1 \
+	python3/ubsan.patch.0 \
 ))
 
 ifneq ($(filter DRAGONFLY FREEBSD LINUX NETBSD OPENBSD SOLARIS,$(OS)),)
diff --git a/python3/python-3.3.3-msvc2012-winxp.patch.1 b/python3/python-3.3.3-msvc2012-winxp.patch.1
new file mode 100644
index 000000000000..2addd4962c07
--- /dev/null
+++ b/python3/python-3.3.3-msvc2012-winxp.patch.1
@@ -0,0 +1,117 @@
+without explicit subsystem set, the linker tries to open a file
+with the name of the comptibility version
+(fatal error LNK1181: cannot open input file ",5.01")
+diff -ur python3.org/PCbuild/_ctypes.vcxproj python3/PCbuild/_ctypes.vcxproj
+--- python3.org/PCbuild/_ctypes.vcxproj	2014-05-19 19:06:01.274114800 +0200
++++ python3/PCbuild/_ctypes.vcxproj	2014-05-19 19:07:13.649079800 +0200
+@@ -174,7 +174,7 @@
+     </ClCompile>
+     <Link>
+       <AdditionalOptions>/EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions)</AdditionalOptions>
+-      <SubSystem>NotSet</SubSystem>
++      <SubSystem>Console</SubSystem>
+       <BaseAddress>0x1D1A0000</BaseAddress>
+     </Link>
+   </ItemDefinitionGroup>
+@@ -187,7 +187,7 @@
+     </ClCompile>
+     <Link>
+       <AdditionalOptions>/EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions)</AdditionalOptions>
+-      <SubSystem>NotSet</SubSystem>
++      <SubSystem>Console</SubSystem>
+       <BaseAddress>0x1D1A0000</BaseAddress>
+     </Link>
+   </ItemDefinitionGroup>
+@@ -197,7 +197,7 @@
+     </ClCompile>
+     <Link>
+       <AdditionalOptions>/EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions)</AdditionalOptions>
+-      <SubSystem>NotSet</SubSystem>
++      <SubSystem>Console</SubSystem>
+       <BaseAddress>0x1D1A0000</BaseAddress>
+     </Link>
+   </ItemDefinitionGroup>
+@@ -210,7 +210,7 @@
+     </ClCompile>
+     <Link>
+       <AdditionalOptions>/EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions)</AdditionalOptions>
+-      <SubSystem>NotSet</SubSystem>
++      <SubSystem>Console</SubSystem>
+       <BaseAddress>0x1D1A0000</BaseAddress>
+       <TargetMachine>MachineX64</TargetMachine>
+     </Link>
+@@ -221,7 +221,7 @@
+     </ClCompile>
+     <Link>
+       <AdditionalOptions>/EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions)</AdditionalOptions>
+-      <SubSystem>NotSet</SubSystem>
++      <SubSystem>Console</SubSystem>
+       <BaseAddress>0x1D1A0000</BaseAddress>
+     </Link>
+   </ItemDefinitionGroup>
+@@ -234,7 +234,7 @@
+     </ClCompile>
+     <Link>
+       <AdditionalOptions>/EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions)</AdditionalOptions>
+-      <SubSystem>NotSet</SubSystem>
++      <SubSystem>Console</SubSystem>
+       <BaseAddress>0x1D1A0000</BaseAddress>
+       <TargetMachine>MachineX64</TargetMachine>
+     </Link>
+diff -ur python3.org/PCbuild/_decimal.vcxproj python3/PCbuild/_decimal.vcxproj
+--- python3.org/PCbuild/_decimal.vcxproj	2014-05-19 19:06:01.274114800 +0200
++++ python3/PCbuild/_decimal.vcxproj	2014-05-19 19:07:13.649079800 +0200
+@@ -176,7 +176,7 @@
+       <AdditionalIncludeDirectories>..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+     </ClCompile>
+     <Link>
+-      <SubSystem>NotSet</SubSystem>
++      <SubSystem>Console</SubSystem>
+       <BaseAddress>0x1D1A0000</BaseAddress>
+     </Link>
+   </ItemDefinitionGroup>
+@@ -189,7 +189,7 @@
+       <AdditionalIncludeDirectories>..\Modules\_decimal;..\Modules\_decimal\libmpdec;..\Include;..\PC;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+     </ClCompile>
+     <Link>
+-      <SubSystem>NotSet</SubSystem>
++      <SubSystem>Console</SubSystem>
+       <BaseAddress>0x1D1A0000</BaseAddress>
+     </Link>
+   </ItemDefinitionGroup>
+@@ -199,7 +199,7 @@
+       <AdditionalIncludeDirectories>..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+     </ClCompile>
+     <Link>
+-      <SubSystem>NotSet</SubSystem>
++      <SubSystem>Console</SubSystem>
+       <BaseAddress>0x1D1A0000</BaseAddress>
+     </Link>
+   </ItemDefinitionGroup>
+@@ -212,7 +212,7 @@
+       <AdditionalIncludeDirectories>..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+     </ClCompile>
+     <Link>
+-      <SubSystem>NotSet</SubSystem>
++      <SubSystem>Console</SubSystem>
+       <BaseAddress>0x1D1A0000</BaseAddress>
+       <TargetMachine>MachineX64</TargetMachine>
+     </Link>
+@@ -223,7 +223,7 @@
+       <AdditionalIncludeDirectories>..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+     </ClCompile>
+     <Link>
+-      <SubSystem>NotSet</SubSystem>
++      <SubSystem>Console</SubSystem>
+       <BaseAddress>0x1D1A0000</BaseAddress>
+     </Link>
+   </ItemDefinitionGroup>
+@@ -236,7 +236,7 @@
+       <AdditionalIncludeDirectories>..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+     </ClCompile>
+     <Link>
+-      <SubSystem>NotSet</SubSystem>
++      <SubSystem>Console</SubSystem>
+       <BaseAddress>0x1D1A0000</BaseAddress>
+       <TargetMachine>MachineX64</TargetMachine>
+     </Link>
diff --git a/python3/python-3.3.3-py17797.patch.1 b/python3/python-3.3.3-py17797.patch.1
index 3c43fb120713..8fcb703f1935 100644
--- a/python3/python-3.3.3-py17797.patch.1
+++ b/python3/python-3.3.3-py17797.patch.1
@@ -3,42 +3,43 @@ http://connect.microsoft.com/VisualStudio/feedback/details/785119/
 
 Visual Studio 2012 changed return value for fileno function that breaks
 when python tries to check/setup stdin/out/err
-diff -ur python3.org/Python/pythonrun.c python3/Python/pythonrun.c
---- python3.org/Python/pythonrun.c	2014-05-19 19:06:01.305362400 +0200
-+++ python3/Python/pythonrun.c	2014-05-19 19:07:13.649079800 +0200
-@@ -1083,7 +1083,11 @@
-      * and fileno() may point to an invalid file descriptor. For example
-      * GUI apps don't have valid standard streams by default.
-      */
-+#ifdef MS_WINDOWS
-+    if (!is_valid_fd(fd) || GetStdHandle(STD_INPUT_HANDLE) == NULL) {
+GetStdHandle on Windows XP behaves contrary to the documentation...
+
+diff --git a/Python/pythonrun.c b/Python/pythonrun.c
+index 91d56b7..d28ffc7 100644
+--- a/Python/pythonrun.c
++++ b/Python/pythonrun.c
+@@ -1015,13 +1015,28 @@ error:
+ static int
+ is_valid_fd(int fd)
+ {
+-    int dummy_fd;
+     if (fd < 0 || !_PyVerify_fd(fd))
+         return 0;
+-    dummy_fd = dup(fd);
+-    if (dummy_fd < 0)
+-        return 0;
+-    close(dummy_fd);
++
++#if defined(MS_WINDOWS) && defined(HAVE_FSTAT)
++    /* dup (DuplicateHandle) doesn't say fd is a valid *file* handle.
++     * It could be a current thread pseudo-handle.
++     */
++    {
++        struct stat buf;
++        if (fstat(fd, &buf) < 0 && (errno == EBADF || errno == ENOENT))
++            return 0;
++    }
 +#else
-     if (!is_valid_fd(fd)) {
++    {
++        int dummy_fd;
++        dummy_fd = dup(fd);
++        if (dummy_fd < 0)
++            return 0;
++        close(dummy_fd);
++    }
 +#endif
-         std = Py_None;
-         Py_INCREF(std);
-     }
-@@ -1098,7 +1102,11 @@
++
+     return 1;
+ }
  
-     /* Set sys.stdout */
-     fd = fileno(stdout);
-+#ifdef MS_WINDOWS
-+    if (!is_valid_fd(fd) || GetStdHandle(STD_OUTPUT_HANDLE) == NULL) {
-+#else
-     if (!is_valid_fd(fd)) {
-+#endif
-         std = Py_None;
-         Py_INCREF(std);
-     }
-@@ -1114,7 +1122,11 @@
- #if 1 /* Disable this if you have trouble debugging bootstrap stuff */
-     /* Set sys.stderr, replaces the preliminary stderr */
-     fd = fileno(stderr);
-+#ifdef MS_WINDOWS
-+    if (!is_valid_fd(fd) || GetStdHandle(STD_ERROR_HANDLE) == NULL) {
-+#else
-     if (!is_valid_fd(fd)) {
-+#endif
-         std = Py_None;
-         Py_INCREF(std);
-     }
diff --git a/python3/python-msvc-disable-sse2.patch.1 b/python3/python-msvc-disable-sse2.patch.1
new file mode 100644
index 000000000000..399aa6016dfc
--- /dev/null
+++ b/python3/python-msvc-disable-sse2.patch.1
@@ -0,0 +1,23 @@
+fdo#82430 disable SSE2 default of MSVC2012
+
+--- python3/PCbuild/release.props.old	2014-10-01 23:47:33.348095403 +0200
++++ python3/PCbuild/release.props	2014-10-01 23:48:05.051092945 +0200
+@@ -9,6 +9,7 @@
+   <ItemDefinitionGroup>
+     <ClCompile>
+       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
++      <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
+     </ClCompile>
+   </ItemDefinitionGroup>
+   <ItemGroup>
+--- python3/PCbuild/make_buildinfo.c.orig	2014-11-03 00:48:58.841000000 +0100
++++ python3/PCbuild/make_buildinfo.c	2014-11-03 00:49:16.266200000 +0100
+@@ -109,7 +109,7 @@
+ 
+ int main(int argc, char*argv[])
+ {
+-    char command[CMD_SIZE] = "cl.exe -c -D_WIN32 -DUSE_DL_EXPORT -D_WINDOWS -DWIN32 -D_WINDLL ";
++    char command[CMD_SIZE] = "cl.exe -arch:SSE -c -D_WIN32 -DUSE_DL_EXPORT -D_WINDOWS -DWIN32 -D_WINDLL ";
+     char tmppath[CMD_SIZE] = "";
+     int do_unlink, result;
+     char *tmpdir = NULL;
diff --git a/python3/ubsan.patch.0 b/python3/ubsan.patch.0
new file mode 100644
index 000000000000..f3623cfd7615
--- /dev/null
+++ b/python3/ubsan.patch.0
@@ -0,0 +1,59 @@
+--- Modules/_ctypes/libffi/src/x86/ffi64.c
++++ Modules/_ctypes/libffi/src/x86/ffi64.c
+@@ -545,11 +545,15 @@
+   tramp = (volatile unsigned short *) &closure->tramp[0];
+ 
+   tramp[0] = 0xbb49;		/* mov <code>, %r11	*/
+-  *((unsigned long long * volatile) &tramp[1])
+-    = (unsigned long) ffi_closure_unix64;
++  tramp[1] = (unsigned long) ffi_closure_unix64;
++  tramp[2] = ((unsigned long) ffi_closure_unix64) >> 16;
++  tramp[3] = ((unsigned long) ffi_closure_unix64) >> 32;
++  tramp[4] = ((unsigned long) ffi_closure_unix64) >> 48;
+   tramp[5] = 0xba49;		/* mov <data>, %r10	*/
+-  *((unsigned long long * volatile) &tramp[6])
+-    = (unsigned long) codeloc;
++  tramp[6] = (unsigned long) codeloc;
++  tramp[7] = ((unsigned long) codeloc) >> 16;
++  tramp[8] = ((unsigned long) codeloc) >> 32;
++  tramp[9] = ((unsigned long) codeloc) >> 48;
+ 
+   /* Set the carry bit iff the function uses any sse registers.
+      This is clc or stc, together with the first byte of the jmp.  */
+--- Objects/bytearrayobject.c
++++ Objects/bytearrayobject.c
+@@ -294,7 +294,7 @@
+         PyBuffer_Release(&vo);
+         return NULL;
+     }
+-    memcpy(self->ob_bytes + mysize, vo.buf, vo.len);
++    if (vo.len != 0) memcpy(self->ob_bytes + mysize, vo.buf, vo.len);
+     PyBuffer_Release(&vo);
+     Py_INCREF(self);
+     return (PyObject *)self;
+--- Objects/listobject.c
++++ Objects/listobject.c
+@@ -641,7 +641,7 @@
+             goto Error;
+         }
+     }
+-    memcpy(recycle, &item[ilow], s);
++    if (s != 0) memcpy(recycle, &item[ilow], s);
+ 
+     if (d < 0) { /* Delete -d items */
+         memmove(&item[ihigh+d], &item[ihigh],
+--- Modules/_ctypes/_ctypes.c
++++ Modules/_ctypes/_ctypes.c
+@@ -1328,8 +1328,10 @@
+     if (stgdict->shape == NULL)
+         goto error;
+     stgdict->shape[0] = length;
+-    memmove(&stgdict->shape[1], itemdict->shape,
+-        sizeof(Py_ssize_t) * (stgdict->ndim - 1));
++    if (itemdict->shape) {
++        memmove(&stgdict->shape[1], itemdict->shape,
++            sizeof(Py_ssize_t) * (stgdict->ndim - 1));
++    }
+ 
+     itemsize = itemdict->size;
+     if (length * itemsize < 0) {
commit afa9c67443b3df6487f28e5a35687ece70d6b74e
Author:     Michael Stahl <mstahl at redhat.com>
AuthorDate: Tue Apr 15 16:48:59 2014 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:48:23 2018 +0200

    python3: remove obsolete MSVC2008 patches
    
    Change-Id: Ie514017dc186fea4c3f2699e92bfe46706eb6413
    (cherry picked from commit 4ce1cec2a4c98451b8b686f6f7a114a6927f0cae)

diff --git a/python3/UnpackedTarball_python3.mk b/python3/UnpackedTarball_python3.mk
index c64f072e4f6a..90f1f68d0a98 100644
--- a/python3/UnpackedTarball_python3.mk
+++ b/python3/UnpackedTarball_python3.mk
@@ -13,10 +13,6 @@ $(eval $(call gb_UnpackedTarball_set_tarball,python3,$(PYTHON_TARBALL)))
 
 $(eval $(call gb_UnpackedTarball_fix_end_of_line,python3,\
 	PCbuild/pcbuild.sln \
-	PC/VS9.0/pcbuild.sln \
-	PC/VS9.0/make_versioninfo.vcproj \
-	PC/VS9.0/x64.vsprops \
-	PC/VS9.0/_ssl.vcproj \
 ))
 
 $(eval $(call gb_UnpackedTarball_add_patches,python3,\
diff --git a/python3/python-3.3.0-msvc-disable.patch.1 b/python3/python-3.3.0-msvc-disable.patch.1
index e9cbef594786..6a6a9509a4ef 100644
--- a/python3/python-3.3.0-msvc-disable.patch.1
+++ b/python3/python-3.3.0-msvc-disable.patch.1
@@ -1,81 +1,5 @@
 Disable some stuff LO does not need, especially stuff with external dependencies
 
-diff -ru python3/PC/VS9.0/pcbuild.sln python3.new/PC/VS9.0/pcbuild.sln
---- python3/PC/VS9.0/pcbuild.sln	2012-09-29 10:00:47.000000000 +0200
-+++ python3.new/PC/VS9.0/pcbuild.sln	2012-11-12 22:34:55.365289858 +0100
-@@ -15,16 +15,6 @@
- 		{C73F0EC1-358B-4177-940F-0846AC8B04CD} = {C73F0EC1-358B-4177-940F-0846AC8B04CD}
- 	EndProjectSection
- EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonw", "pythonw.vcproj", "{F4229CC3-873C-49AE-9729-DD308ED4CD4A}"
--	ProjectSection(ProjectDependencies) = postProject
--		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
--	EndProjectSection
--EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "w9xpopen", "w9xpopen.vcproj", "{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}"
--	ProjectSection(ProjectDependencies) = postProject
--		{6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}
--	EndProjectSection
--EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_buildinfo", "make_buildinfo.vcproj", "{C73F0EC1-358B-4177-940F-0846AC8B04CD}"
- EndProject
- Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{553EC33E-9816-4996-A660-5D6186A0B0B3}"
-@@ -68,12 +58,6 @@
- 		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
- 	EndProjectSection
- EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_sqlite3", "_sqlite3.vcproj", "{13CECB97-4119-4316-9D42-8534019A5A44}"
--	ProjectSection(ProjectDependencies) = postProject
--		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
--		{A1A295E5-463C-437F-81CA-1F32367685DA} = {A1A295E5-463C-437F-81CA-1F32367685DA}
--	EndProjectSection
--EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ssl", "_ssl.vcproj", "{C6E20F84-3247-4AD6-B051-B073268F73BA}"
- 	ProjectSection(ProjectDependencies) = postProject
- 		{B11D750F-CD1F-4A96-85CE-E69A5C5259F9} = {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}
-@@ -87,21 +71,6 @@
- 		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
- 	EndProjectSection
- EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_tkinter", "_tkinter.vcproj", "{4946ECAC-2E69-4BF8-A90A-F5136F5094DF}"
--	ProjectSection(ProjectDependencies) = postProject
--		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
--	EndProjectSection
--EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bz2", "_bz2.vcproj", "{73FCD2BD-F133-46B7-8EC1-144CD82A59D5}"
--	ProjectSection(ProjectDependencies) = postProject
--		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
--	EndProjectSection
--EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_lzma", "_lzma.vcproj", "{F9D71780-F393-11E0-BE50-0800200C9A66}"
--	ProjectSection(ProjectDependencies) = postProject
--		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
--	EndProjectSection
--EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select", "select.vcproj", "{18CAE28C-B454-46C1-87A0-493D91D97F03}"
- 	ProjectSection(ProjectDependencies) = postProject
- 		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
-@@ -117,20 +86,6 @@
- 		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
- 	EndProjectSection
- EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bdist_wininst", "bdist_wininst.vcproj", "{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}"
--EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_hashlib", "_hashlib.vcproj", "{447F05A8-F581-4CAC-A466-5AC7936E207E}"
--	ProjectSection(ProjectDependencies) = postProject
--		{B11D750F-CD1F-4A96-85CE-E69A5C5259F9} = {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}
--		{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0} = {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}
--		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
--	EndProjectSection
--EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}"
--	ProjectSection(ProjectDependencies) = postProject
--		{6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}
--	EndProjectSection
--EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multiprocessing.vcproj", "{9E48B300-37D1-11DD-8C41-005056C00008}"
- 	ProjectSection(ProjectDependencies) = postProject
- 		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
 diff -ru python3/PCbuild/pcbuild.sln python3.new/PCbuild/pcbuild.sln
 --- python3/PCbuild/pcbuild.sln	2012-09-29 10:00:48.000000000 +0200
 +++ python3.new/PCbuild/pcbuild.sln	2012-11-12 22:13:49.445159668 +0100
diff --git a/python3/python-3.3.0-msvc-x64.patch.1 b/python3/python-3.3.0-msvc-x64.patch.1
index 9c3c96352f72..8882a1c87fc0 100644
--- a/python3/python-3.3.0-msvc-x64.patch.1
+++ b/python3/python-3.3.0-msvc-x64.patch.1
@@ -1,118 +1,5 @@
 Fix Python build for x64 Windows
 
-diff -ru python3/PC/VS9.0/make_versioninfo.vcproj python3.new/PC/VS9.0/make_versioninfo.vcproj
---- python3/PC/VS9.0/make_versioninfo.vcproj	2012-09-29 10:00:47.000000000 +0200
-+++ python3.new/PC/VS9.0/make_versioninfo.vcproj	2012-11-12 22:44:03.027363013 +0100
-@@ -124,6 +124,8 @@
- 				InlineFunctionExpansion="1"
- 				EnableIntrinsicFunctions="true"
- 				PreprocessorDefinitions="_CONSOLE"
-+				RuntimeLibrary="2"
-+				CompileAs="0"
- 			/>
- 			<Tool
- 				Name="VCManagedResourceCompilerTool"
-@@ -137,6 +139,8 @@
- 			<Tool
- 				Name="VCLinkerTool"
- 				OutputFile="$(SolutionDir)make_versioninfo.exe"
-+				ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
-+				SubSystem="1"
- 			/>
- 			<Tool
- 				Name="VCALinkTool"
-@@ -281,7 +285,8 @@
- 			<Tool
- 				Name="VCLinkerTool"
- 				OutputFile="$(SolutionDir)make_versioninfo_d.exe"
--				TargetMachine="17"
-+				ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
-+				SubSystem="1"
- 			/>
- 			<Tool
- 				Name="VCALinkTool"
-diff -ru python3/PC/VS9.0/pcbuild.sln python3.new/PC/VS9.0/pcbuild.sln
---- python3/PC/VS9.0/pcbuild.sln	2012-09-29 10:00:47.000000000 +0200
-+++ python3.new/PC/VS9.0/pcbuild.sln	2012-11-12 22:34:55.365289858 +0100
-@@ -182,20 +137,20 @@
- 		{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.Build.0 = Release|x64
- 		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.ActiveCfg = Debug|Win32
- 		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.Build.0 = Debug|Win32
--		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.ActiveCfg = Debug|Win32
--		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.Build.0 = Debug|Win32
-+		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.ActiveCfg = Debug|x64
-+		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.Build.0 = Debug|x64
- 		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|Win32.ActiveCfg = Release|Win32
- 		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|Win32.Build.0 = Release|Win32
--		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|x64.ActiveCfg = Release|Win32
--		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|x64.Build.0 = Release|Win32
-+		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|x64.ActiveCfg = Release|x64
-+		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|x64.Build.0 = Release|x64
- 		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|Win32.ActiveCfg = Release|Win32
- 		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|Win32.Build.0 = Release|Win32
--		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|x64.ActiveCfg = Release|Win32
--		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|x64.Build.0 = Release|Win32
-+		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|x64.ActiveCfg = Release|x64
-+		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|x64.Build.0 = Release|x64
- 		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.ActiveCfg = Release|Win32
- 		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.Build.0 = Release|Win32
--		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.ActiveCfg = Release|Win32
--		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.Build.0 = Release|Win32
-+		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.ActiveCfg = Release|x64
-+		{F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.Build.0 = Release|x64
- 		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.ActiveCfg = Debug|Win32
- 		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.Build.0 = Debug|Win32
- 		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.ActiveCfg = Debug|x64
-@@ -246,20 +201,20 @@
- 		{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.Build.0 = Release|x64
- 		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.ActiveCfg = Release|Win32
- 		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.Build.0 = Release|Win32
--		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.ActiveCfg = Release|Win32
--		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.Build.0 = Release|Win32
-+		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.ActiveCfg = Release|x64
-+		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.Build.0 = Release|x64
- 		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|Win32.ActiveCfg = Release|Win32
- 		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|Win32.Build.0 = Release|Win32
--		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|x64.ActiveCfg = Release|Win32
--		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|x64.Build.0 = Release|Win32
-+		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|x64.ActiveCfg = Release|x64
-+		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|x64.Build.0 = Release|x64
- 		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|Win32.ActiveCfg = Release|Win32
- 		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|Win32.Build.0 = Release|Win32
--		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|x64.ActiveCfg = Release|Win32
--		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|x64.Build.0 = Release|Win32
-+		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|x64.ActiveCfg = Release|x64
-+		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|x64.Build.0 = Release|x64
- 		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.ActiveCfg = Release|Win32
- 		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.Build.0 = Release|Win32
--		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.ActiveCfg = Release|Win32
--		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.Build.0 = Release|Win32
-+		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.ActiveCfg = Release|x64
-+		{C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.Build.0 = Release|x64
- 		{28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|Win32.ActiveCfg = Debug|Win32
- 		{28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|Win32.Build.0 = Debug|Win32
- 		{28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|x64.ActiveCfg = Debug|x64
-diff -ru python3/PC/VS9.0/x64.vsprops python3.new/PC/VS9.0/x64.vsprops
---- python3/PC/VS9.0/x64.vsprops	2012-09-29 10:00:47.000000000 +0200
-+++ python3.new/PC/VS9.0/x64.vsprops	2012-11-12 22:45:30.584374039 +0100
-@@ -3,7 +3,7 @@
- 	ProjectType="Visual C++"
- 	Version="8.00"
- 	Name="amd64"
--	OutputDirectory="$(SolutionDir)\amd64\"
-+	OutputDirectory="$(SolutionDir)"
- 	IntermediateDirectory="$(SolutionDir)$(PlatformName)-temp-$(ConfigurationName)\$(ProjectName)\"
- 	>
- 	<Tool
-@@ -15,8 +15,4 @@
- 		Name="VCLinkerTool"
- 		TargetMachine="17"
- 	/>
--	<UserMacro
--		Name="PythonExe"
--		Value="$(HOST_PYTHON)"
--	/>
- </VisualStudioPropertySheet>
 diff -ru python3/PCbuild/pcbuild.sln python3.new/PCbuild/pcbuild.sln
 --- python3/PCbuild/pcbuild.sln	2012-09-29 10:00:48.000000000 +0200
 +++ python3.new/PCbuild/pcbuild.sln	2012-11-12 22:13:49.445159668 +0100
diff --git a/python3/python-3.3.0-ssl.patch.1 b/python3/python-3.3.0-ssl.patch.1
index d5777dfc3252..b85fe076fff8 100644
--- a/python3/python-3.3.0-ssl.patch.1
+++ b/python3/python-3.3.0-ssl.patch.1
@@ -24,168 +24,6 @@ diff -ru python3.old_/Modules/Setup.dist python3/Modules/Setup.dist
  
  
  # The _tkinter module.
-diff -ru python3.old_/PC/VS9.0/pcbuild.sln python3/PC/VS9.0/pcbuild.sln
---- python3.old_/PC/VS9.0/pcbuild.sln	2012-09-29 10:00:47.000000000 +0200
-+++ python3/PC/VS9.0/pcbuild.sln	2012-11-13 14:44:29.329147866 +0100
-@@ -136,11 +136,6 @@
- 		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
- 	EndProjectSection
- EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssl", "ssl.vcproj", "{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}"
--	ProjectSection(ProjectDependencies) = postProject
--		{B11D750F-CD1F-4A96-85CE-E69A5C5259F9} = {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}
--	EndProjectSection
--EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kill_python", "kill_python.vcproj", "{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}"
- EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python3dll", "python3dll.vcproj", "{885D4898-D08D-4091-9C40-C700CFE3FC5A}"
-diff -ru python3.old_/PC/VS9.0/_ssl.vcproj python3/PC/VS9.0/_ssl.vcproj
---- python3.old_/PC/VS9.0/_ssl.vcproj	2012-09-29 10:00:47.000000000 +0200
-+++ python3/PC/VS9.0/_ssl.vcproj	2012-11-13 14:27:15.874169273 +0100
-@@ -42,7 +42,7 @@
- 			/>
- 			<Tool
- 				Name="VCCLCompilerTool"
--				AdditionalIncludeDirectories="$(opensslDir)\inc32"
-+				AdditionalIncludeDirectories="$(WORKDIR)/UnpackedTarball/openssl/include"
- 			/>
- 			<Tool
- 				Name="VCManagedResourceCompilerTool"
-@@ -56,7 +56,7 @@
- 			/>
- 			<Tool
- 				Name="VCLinkerTool"
--				AdditionalDependencies="ws2_32.lib $(opensslDir)\out32\libeay32.lib $(opensslDir)\out32\ssleay32.lib"
-+				AdditionalDependencies="ws2_32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\libeay32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\ssleay32.lib"
- 			/>
- 			<Tool
- 				Name="VCALinkTool"
-@@ -104,7 +104,7 @@
- 			/>
- 			<Tool
- 				Name="VCCLCompilerTool"
--				AdditionalIncludeDirectories="$(opensslDir)\inc64"
-+				AdditionalIncludeDirectories="$(WORKDIR)/UnpackedTarball/openssl/include"
- 			/>
- 			<Tool
- 				Name="VCManagedResourceCompilerTool"
-@@ -118,7 +118,7 @@
- 			/>
- 			<Tool
- 				Name="VCLinkerTool"
--				AdditionalDependencies="ws2_32.lib $(opensslDir)\out64\libeay32.lib $(opensslDir)\out64\ssleay32.lib"
-+				AdditionalDependencies="ws2_32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\libeay32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\ssleay32.lib"
- 			/>
- 			<Tool
- 				Name="VCALinkTool"
-@@ -166,7 +166,7 @@
- 			/>
- 			<Tool
- 				Name="VCCLCompilerTool"
--				AdditionalIncludeDirectories="$(opensslDir)\inc32"
-+				AdditionalIncludeDirectories="$(WORKDIR)/UnpackedTarball/openssl/include"
- 			/>
- 			<Tool
- 				Name="VCManagedResourceCompilerTool"
-@@ -180,7 +180,7 @@
- 			/>
- 			<Tool
- 				Name="VCLinkerTool"
--				AdditionalDependencies="ws2_32.lib $(opensslDir)\out32\libeay32.lib $(opensslDir)\out32\ssleay32.lib"
-+				AdditionalDependencies="ws2_32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\libeay32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\ssleay32.lib"
- 			/>
- 			<Tool
- 				Name="VCALinkTool"
-@@ -229,7 +229,7 @@
- 			/>
- 			<Tool
- 				Name="VCCLCompilerTool"
--				AdditionalIncludeDirectories="$(opensslDir)\inc64"
-+				AdditionalIncludeDirectories="$(WORKDIR)/UnpackedTarball/openssl/include"
- 			/>
- 			<Tool
- 				Name="VCManagedResourceCompilerTool"
-@@ -243,7 +243,7 @@
- 			/>
- 			<Tool
- 				Name="VCLinkerTool"
--				AdditionalDependencies="ws2_32.lib $(opensslDir)\out64\libeay32.lib $(opensslDir)\out64\ssleay32.lib"
-+				AdditionalDependencies="ws2_32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\libeay32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\ssleay32.lib"
- 			/>
- 			<Tool
- 				Name="VCALinkTool"
-@@ -291,7 +291,7 @@
- 			/>
- 			<Tool
- 				Name="VCCLCompilerTool"
--				AdditionalIncludeDirectories="$(opensslDir)\inc32"
-+				AdditionalIncludeDirectories="$(WORKDIR)/UnpackedTarball/openssl/include"
- 			/>
- 			<Tool
- 				Name="VCManagedResourceCompilerTool"
-@@ -305,7 +305,7 @@
- 			/>
- 			<Tool
- 				Name="VCLinkerTool"
--				AdditionalDependencies="ws2_32.lib $(opensslDir)\out32\libeay32.lib $(opensslDir)\out32\ssleay32.lib"
-+				AdditionalDependencies="ws2_32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\libeay32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\ssleay32.lib"
- 			/>
- 			<Tool
- 				Name="VCALinkTool"
-@@ -354,7 +354,7 @@
- 			/>
- 			<Tool
- 				Name="VCCLCompilerTool"
--				AdditionalIncludeDirectories="$(opensslDir)\inc64"
-+				AdditionalIncludeDirectories="$(WORKDIR)/UnpackedTarball/openssl/include"
- 			/>
- 			<Tool
- 				Name="VCManagedResourceCompilerTool"
-@@ -368,7 +368,7 @@
- 			/>
- 			<Tool
- 				Name="VCLinkerTool"
--				AdditionalDependencies="ws2_32.lib $(opensslDir)\out64\libeay32.lib $(opensslDir)\out64\ssleay32.lib"
-+				AdditionalDependencies="ws2_32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\libeay32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\ssleay32.lib"
- 				TargetMachine="17"
- 			/>
- 			<Tool
-@@ -417,7 +417,7 @@
- 			/>
- 			<Tool
- 				Name="VCCLCompilerTool"
--				AdditionalIncludeDirectories="$(opensslDir)\inc32"
-+				AdditionalIncludeDirectories="$(WORKDIR)/UnpackedTarball/openssl/include"
- 			/>
- 			<Tool
- 				Name="VCManagedResourceCompilerTool"
-@@ -431,7 +431,7 @@
- 			/>
- 			<Tool
- 				Name="VCLinkerTool"
--				AdditionalDependencies="ws2_32.lib $(opensslDir)\out32\libeay32.lib $(opensslDir)\out32\ssleay32.lib"
-+				AdditionalDependencies="ws2_32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\libeay32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\ssleay32.lib"
- 			/>
- 			<Tool
- 				Name="VCALinkTool"
-@@ -480,7 +480,7 @@
- 			/>
- 			<Tool
- 				Name="VCCLCompilerTool"
--				AdditionalIncludeDirectories="$(opensslDir)\inc64"
-+				AdditionalIncludeDirectories="$(WORKDIR)/UnpackedTarball/openssl/include"
- 			/>
- 			<Tool
- 				Name="VCManagedResourceCompilerTool"
-@@ -494,7 +494,7 @@
- 			/>
- 			<Tool
- 				Name="VCLinkerTool"
--				AdditionalDependencies="ws2_32.lib $(opensslDir)\out64\libeay32.lib $(opensslDir)\out64\ssleay32.lib"
-+				AdditionalDependencies="ws2_32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\libeay32.lib $(WORKDIR)\UnpackedTarball\openssl\out32dll\ssleay32.lib"
- 				TargetMachine="17"
- 			/>
- 			<Tool
 diff -ru python3.old_/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln
 --- python3.old_/PCbuild/pcbuild.sln	2012-09-29 10:00:48.000000000 +0200
 +++ python3/PCbuild/pcbuild.sln	2012-11-13 14:50:39.220142472 +0100
commit b68423b5e5b117ac0dcac446662a8a5aec4d2eb9
Author:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
AuthorDate: Thu Aug 16 14:40:02 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:48:23 2018 +0200

    python3: upgrade to 3.3.7
    
    - update to latest stable from 3.3 branch, with some security fixes
    - adjust patches - python-3.3.0-implicit-int.patch.1 now upstream
    - drop patches for unsupported platforms
    
    Change-Id: I3aac4f1a702ba7239830c4ebf887bc66afedf9cb

diff --git a/Makefile.fetch b/Makefile.fetch
index c3c471174b7d..3bfca1e61c36 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -82,6 +82,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
 		$(call fetch_Optional,MWAW,MWAW_TARBALL) \
 		$(call fetch_Optional,NSS,NSS_TARBALL) \
 		$(call fetch_Optional,OPENSSL,OPENSSL_TARBALL) \
+		$(call fetch_Optional,PYTHON,PYTHON_TARBALL) \
 		$(call fetch_Optional,VISIO,VISIO_TARBALL) \
 		$(call fetch_Optional,ZLIB,ZLIB_TARBALL) \
 	,$(call fetch_Download_item_special,https://dev-www.libreoffice.org/src,$(item)))
@@ -152,7 +153,6 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
 		$(call fetch_Optional,CAIRO,$(PIXMAN_TARBALL)) \
 		$(call fetch_Optional,LIBPNG,$(PNG_TARBALL)) \
 		$(call fetch_Optional,POSTGRESQL,$(POSTGRESQL_TARBALL)) \
-		$(call fetch_Optional,PYTHON,$(PYTHON_TARBALL)) \
 		$(call fetch_Optional,REDLAND,$(RAPTOR_TARBALL)) \
 		$(call fetch_Optional,REDLAND,$(RASQAL_TARBALL)) \
 		$(call fetch_Optional,REDLAND,$(REDLAND_TARBALL)) \
diff --git a/download.lst b/download.lst
index 24a7d0db48c1..33f52b13134b 100644
--- a/download.lst
+++ b/download.lst
@@ -16,6 +16,8 @@ ZLIB_MD5SUM := 85adef240c5f370b308da8c938951a68
 export ZLIB_TARBALL := zlib-1.2.11.tar.xz
 OPENSSL_MD5SUM := 44279b8557c3247cbe324e2322ecd114
 export OPENSSL_TARBALL := openssl-1.0.2o.tar.gz
+PYTHON_MD5SUM := 84e2f12f044ca53b577f6224c53f82ac
+export PYTHON_TARBALL := Python-3.3.7.tar.xz
 
 export AFMS_TARBALL := 1756c4fa6c616ae15973c104cd8cb256-Adobe-Core35_AFMs-314.tar.gz
 export APACHE_COMMONS_CODEC_TARBALL := 2e482c7567908d334785ce7d69ddfff7-commons-codec-1.6-src.tar.gz
@@ -84,7 +86,6 @@ export PIXMAN_TARBALL := c63f411b3ad147db2bcce1bf262a0e02-pixman-0.24.4.tar.bz2
 export PNG_MD5SUM := 6652e428d1d3fc3c6cb1362159b1cf3b
 export PNG_TARBALL := libpng-1.5.24.tar.gz
 export POSTGRESQL_TARBALL := c0b4799ea9850eae3ead14f0a60e9418-postgresql-9.2.1.tar.bz2
-export PYTHON_TARBALL := f3ebe34d4d8695bf889279b54673e10c-Python-3.3.3.tar.bz2
 export RAPTOR_TARBALL := 4ceb9316488b0ea01acf011023cf7fff-raptor2-2.0.9.tar.gz
 export RASQAL_TARBALL := b12c5f9cfdb6b04efce5a4a186b8416b-rasqal-0.9.30.tar.gz
 export REDLAND_TARBALL := 32f8e1417a64d3c6f2c727f9053f55ea-redland-1.0.16.tar.gz
diff --git a/python3/UnpackedTarball_python3.mk b/python3/UnpackedTarball_python3.mk
index acd420d4dea4..c64f072e4f6a 100644
--- a/python3/UnpackedTarball_python3.mk
+++ b/python3/UnpackedTarball_python3.mk
@@ -20,15 +20,11 @@ $(eval $(call gb_UnpackedTarball_fix_end_of_line,python3,\
 ))
 
 $(eval $(call gb_UnpackedTarball_add_patches,python3,\
-	python3/i100492-freebsd.patch.1 \
 	python3/python-3.3.0-i42553.patch.2 \
-	python3/python-3.3.3-aix.patch.1 \
-	python3/python-3.3.0-darwin.patch.1 \
 	python3/python-3.3.0-msvc2012.patch.1 \
 	python3/python-3.3.0-msvc-disable.patch.1 \
 	python3/python-3.3.0-msvc-x64.patch.1 \
 	python3/python-3.3.0-ssl.patch.1 \
-	python3/python-3.3.0-implicit-int.patch.1 \
 	python3/python-3.3.0-gcc-4.8.patch.1 \
 	python3/python-3.3.0-pythreadstate.patch.1 \
 	python3/python-3.3.3-py17797.patch.1 \
diff --git a/python3/i100492-freebsd.patch.1 b/python3/i100492-freebsd.patch.1
deleted file mode 100644
index 7189a7e81956..000000000000
--- a/python3/i100492-freebsd.patch.1
+++ /dev/null
@@ -1,80 +0,0 @@
-FreeBSD porting fixes, patch by maho at openoffice.org
-
---- Python-3.3.0/configure	2012-11-28 09:00:41.094955090 +0000
-+++ Python-3.3.0/configure	2012-11-28 09:01:13.033329526 +0000
-@@ -5545,11 +5545,6 @@
- 	  LDLIBRARY='libpython$(LDVERSION).so'
- 	  BLDLIBRARY='-L. -lpython$(LDVERSION)'
- 	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
--	  case $ac_sys_system in
--	      FreeBSD*)
--		SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
--		;;
--	  esac
- 	  INSTSONAME="$LDLIBRARY".$SOVERSION
- 	  if test "$with_pydebug" != yes
-           then
---- Python-3.3.0/Lib/test/test_threading.py	2012-11-28 09:00:41.292957412 +0000
-+++ Python-3.3.0/Lib/test/test_threading.py	2012-11-28 09:01:13.017329339 +0000
-@@ -451,7 +451,7 @@
-     # #12316 and #11870), and fork() from a worker thread is known to trigger
-     # problems with some operating systems (issue #3863): skip problematic tests
-     # on platforms known to behave badly.
--    platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5',
-+    platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'netbsd5',
-                          'os2emx', 'hp-ux11')
- 
-     def _run_and_join(self, script):
---- Python-3.3.0/Python/thread_pthread.h	2012-11-28 09:00:41.097955124 +0000
-+++ Python-3.3.0/Python/thread_pthread.h	2012-11-28 09:01:13.018329351 +0000
-@@ -42,6 +42,10 @@
- #endif
- #endif
- 
-+#ifdef __FreeBSD__
-+#include <osreldate.h>
-+#endif
-+
- /* The POSIX spec says that implementations supporting the sem_*
-    family of functions must indicate this by defining
-    _POSIX_SEMAPHORES. */
-@@ -60,7 +64,6 @@
-    in default setting.  So the process scope is preferred to get
-    enough number of threads to work. */
- #ifdef __FreeBSD__
--#include <osreldate.h>
- #if __FreeBSD_version >= 500000 && __FreeBSD_version < 504101
- #undef PTHREAD_SYSTEM_SCHED_SUPPORTED
- #endif
-@@ -186,6 +189,9 @@
- {
-     pthread_t th;
-     int status;
-+#ifdef __FreeBSD__
-+	sigset_t set, oset;
-+#endif
- #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
-     pthread_attr_t attrs;
- #endif
-@@ -214,7 +220,10 @@
- #if defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
-     pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM);
- #endif
--
-+#ifdef __FreeBSD__
-+	sigfillset(&set);
-+	SET_THREAD_SIGMASK(SIG_BLOCK, &set, &oset);
-+#endif
-     status = pthread_create(&th,
- #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
-                              &attrs,
-@@ -225,6 +234,9 @@
-                              (void *)arg
-                              );
- 
-+#ifdef __FreeBSD__
-+	SET_THREAD_SIGMASK(SIG_SETMASK, &oset, NULL);
-+#endif
- #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
-     pthread_attr_destroy(&attrs);
- #endif
diff --git a/python3/python-3.3.0-darwin.patch.1 b/python3/python-3.3.0-darwin.patch.1
deleted file mode 100644
index 7c43d8b419db..000000000000
--- a/python3/python-3.3.0-darwin.patch.1
+++ /dev/null
@@ -1,26 +0,0 @@
-LO needs to build both against MacOSX SDK and not produce universal binaries.
-
-diff -ru python3.old_/configure python3/configure
---- python3.old_/configure	2012-09-29 10:00:50.000000000 +0200
-+++ python3/configure	2012-11-13 16:37:26.030013256 +0100
-@@ -6353,7 +6353,19 @@
- 	    if test "${enable_universalsdk}"; then
- 		UNIVERSAL_ARCH_FLAGS=""
- 	        if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
--		   UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
-+           # LO does not use Universal Binaries (but the only way to set a SDK
-+           # here implies that, so de-universalize here...)
-+           case `/usr/bin/arch` in
-+           i386)
-+               UNIVERSAL_ARCH_FLAGS="-arch i386"
-+               ;;
-+           ppc)
-+               UNIVERSAL_ARCH_FLAGS="-arch ppc"
-+               ;;
-+           *)
-+               as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
-+               ;;
-+           esac
- 		   ARCH_RUN_32BIT=""
- 		   LIPO_32BIT_FLAGS=""
- 	         elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
diff --git a/python3/python-3.3.0-implicit-int.patch.1 b/python3/python-3.3.0-implicit-int.patch.1
deleted file mode 100644
index 6e4d2b05127d..000000000000
--- a/python3/python-3.3.0-implicit-int.patch.1
+++ /dev/null
@@ -1,30 +0,0 @@
-fix function names in import.h
-
-MSVC complains about some declarations in Include/import.h.
-Apparently the problem is a missing space between PyAPI_FUNC(int) and the
-function name, leading to concatenated int_PyImport... names and no
-return type.
-
-diff -ru python3.old/Include/import.h python3/Include/import.h
---- python3.old/Include/import.h	2012-09-29 10:00:26.000000000 +0200
-+++ python3/Include/import.h	2012-11-27 16:09:26.449390966 +0100
-@@ -86,15 +86,15 @@
- 
- PyAPI_FUNC(void) _PyImport_ReInitLock(void);
- 
--PyAPI_FUNC(PyObject *)_PyImport_FindBuiltin(
-+PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin(
-     const char *name            /* UTF-8 encoded string */
-     );
--PyAPI_FUNC(PyObject *)_PyImport_FindExtensionObject(PyObject *, PyObject *);
--PyAPI_FUNC(int)_PyImport_FixupBuiltin(
-+PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
-+PyAPI_FUNC(int) _PyImport_FixupBuiltin(
-     PyObject *mod,
-     char *name                  /* UTF-8 encoded string */
-     );
--PyAPI_FUNC(int)_PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *);
-+PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *);
- 
- struct _inittab {
-     char *name;                 /* ASCII encoded string */
diff --git a/python3/python-3.3.0-msvc-x64.patch.1 b/python3/python-3.3.0-msvc-x64.patch.1
index 7071573c04ac..9c3c96352f72 100644
--- a/python3/python-3.3.0-msvc-x64.patch.1
+++ b/python3/python-3.3.0-msvc-x64.patch.1
@@ -323,7 +323,7 @@ diff -ru python3/PCbuild/pcbuild.sln python3.new/PCbuild/pcbuild.sln
    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 --- python3/PCbuild/pythoncore.vcxproj
 +++ python3/PCbuild/pythoncore.vcxproj
-@@ -185,35 +185,35 @@
+@@ -195,35 +195,35 @@
    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
      <Midl>
        <TargetEnvironment>X64</TargetEnvironment>
@@ -349,14 +349,14 @@ diff -ru python3/PCbuild/pcbuild.sln python3.new/PCbuild/pcbuild.sln
        <IgnoreSpecificDefaultLibraries>libc;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
        <BaseAddress>0x1e000000</BaseAddress>
      </Link>
+     <PreBuildEvent>
+       <Command>$(KillPythonExe)
+ IF %ERRORLEVEL% NEQ 0 (
+     echo kill_python: warning: could not kill running Pythons, exit code %ERRORLEVEL%
+     exit /b 0
+ )</Command>
+     </PreBuildEvent>
+     <PreBuildEvent>
+       <Message>Killing any running $(PythonExe) instances...</Message>
+     </PreBuildEvent>
    </ItemDefinitionGroup>
-   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-     <ClCompile>
-       <AdditionalOptions>/Zm200  %(AdditionalOptions)</AdditionalOptions>
-       <Optimization>Disabled</Optimization>
-       <InlineFunctionExpansion>Default</InlineFunctionExpansion>
-       <IntrinsicFunctions>false</IntrinsicFunctions>
-       <AdditionalIncludeDirectories>..\Python;..\Modules\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-       <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-     </ClCompile>
diff --git a/python3/python-3.3.3-aix.patch.1 b/python3/python-3.3.3-aix.patch.1
deleted file mode 100644
index f510a81da840..000000000000
--- a/python3/python-3.3.3-aix.patch.1
+++ /dev/null
@@ -1,145 +0,0 @@
-build with GCC on AIX
-
---- Python-3.3.3/configure	2012-11-28 09:05:45.990529603 +0000
-+++ Python-3.3.3/configure	2012-11-28 09:06:23.037963934 +0000
-@@ -3426,8 +3426,6 @@
- else
- 
- 	case $ac_sys_system in
--	AIX*)   CC=${CC:-xlc_r}
--		without_gcc=;;
- 	*)	without_gcc=no;;
- 	esac
- fi
-@@ -5541,10 +5539,18 @@
- 	      PY3LIBRARY=libpython3.so
- 	  fi
-           ;;
--    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
-+    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|AIX*)
- 	  LDLIBRARY='libpython$(LDVERSION).so'
--	  BLDLIBRARY='-L. -lpython$(LDVERSION)'
--	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
-+	  case $ac_sys_system in
-+	    AIX*)
-+	      BLDLIBRARY='-Wl,-brtl -L. -lpython$(LDVERSION)'
-+	      RUNSHARED=LIBPATH=`pwd`:${LIBPATH}
-+	      ;;
-+	    *)
-+	      BLDLIBRARY='-L. -lpython$(LDVERSION)'
-+	      RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
-+	      ;;
-+	  esac
- 	  INSTSONAME="$LDLIBRARY".$SOVERSION
- 	  if test "$with_pydebug" != yes
-           then
-@@ -8301,8 +8307,13 @@
- then
- 	case $ac_sys_system/$ac_sys_release in
- 	AIX*)
--		BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
--		LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
-+		if test "$GCC" = "yes"; then
-+		  LDSHARED='$(CC) -shared'
-+		  BLDSHARED='$(CC) -Wl,-brtl -shared'
-+		else
-+		  BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
-+		  LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
-+		fi
- 		;;
- 	IRIX/5*) LDSHARED="ld -shared";;
- 	IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
---- Python-3.3.3/configure.ac	2012-11-28 09:05:45.990529603 +0000
-+++ Python-3.3.3/configure.ac	2012-11-28 09:06:23.038963946 +0000
-@@ -545,8 +545,6 @@
- 		without_gcc=$withval;;
- 	esac], [
- 	case $ac_sys_system in
--	AIX*)   CC=${CC:-xlc_r}
--		without_gcc=;;
- 	*)	without_gcc=no;;
- 	esac])
- AC_MSG_RESULT($without_gcc)
-@@ -910,10 +908,18 @@
- 	      PY3LIBRARY=libpython3.so
- 	  fi
-           ;;
--    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
-+    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|AIX*)
- 	  LDLIBRARY='libpython$(LDVERSION).so'
--	  BLDLIBRARY='-L. -lpython$(LDVERSION)'
--	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
-+	  case $ac_sys_system in
-+	    AIX*)
-+	      BLDLIBRARY='-Wl,-brtl -L. -lpython$(LDVERSION)'
-+	      RUNSHARED=LIBPATH=`pwd`:${LIBPATH}
-+	      ;;
-+	    *)
-+	      BLDLIBRARY='-L. -lpython$(LDVERSION)'
-+	      RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
-+	      ;;
-+	  esac
- 	  case $ac_sys_system in
- 	      FreeBSD*)
- 		SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
-@@ -1866,8 +1872,13 @@
- then
- 	case $ac_sys_system/$ac_sys_release in
- 	AIX*)
--		BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
--		LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
-+		if test "$GCC" = "yes"; then
-+			LDSHARED='$(CC) -shared'
-+			BLDSHARED='$(CC) -Wl,-brtl -shared'
-+		else
-+			BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
-+			LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
-+		fi
- 		;;
- 	IRIX/5*) LDSHARED="ld -shared";;
- 	IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
---- Python-3.3.3/Makefile.pre.in	2012-11-28 09:05:45.861528086 +0000
-+++ Python-3.3.3/Makefile.pre.in	2012-11-28 09:06:23.046964040 +0000
-@@ -493,14 +493,20 @@
- 
- libpython$(LDVERSION).so: $(LIBRARY_OBJS)
- 	if test $(INSTSONAME) != $(LDLIBRARY); then \
--		$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
-+		if [ "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" != "aix" ]; then \
-+			SONAME="-Wl,-h$(INSTSONAME)"; \
-+		fi; \
-+		$(BLDSHARED) $(SONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
- 		$(LN) -f $(INSTSONAME) $@; \
- 	else \
- 		$(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
- 	fi
- 
- libpython3.so:	libpython$(LDVERSION).so
--	$(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
-+	if [ "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" != "aix" ]; then \
-+		SONAME="-Wl,-h$@"; \
-+	fi; \
-+	$(BLDSHARED) $(NO_AS_NEEDED) -o $@ $(SONAME) $^
- 
- libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
- 	 $(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
-@@ -1106,6 +1112,8 @@
- 	export PATH; PATH="`pwd`:$$PATH"; \
- 	export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
- 	export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
-+	export LD_LIBRARY_PATH; LD_LIBRARY_PATH="`pwd`${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"; \
-+	export LIBPATH; LIBPATH="`pwd`${LIBPATH:+:$LIBPATH}"; \
- 	export EXE; EXE="$(BUILDEXE)"; \
- 	if [ -n "$(MULTIARCH)" ]; then export MULTIARCH; MULTIARCH=$(MULTIARCH); fi; \
- 	export PYTHON_FOR_BUILD; \
---- Python-3.3.3/Modules/Setup.dist	2012-11-28 09:05:45.935528957 +0000
-+++ Python-3.3.3/Modules/Setup.dist	2012-11-28 09:06:23.052964111 +0000
-@@ -177,7 +177,7 @@
- #_bisect _bisectmodule.c	# Bisection algorithms
- #_heapq _heapqmodule.c	# Heap queue algorithm
- 
--#unicodedata unicodedata.c    # static Unicode character database
-+unicodedata unicodedata.c    # static Unicode character database
- 
- 
- # Modules with some UNIX dependencies -- on by default:
commit 72d1a37ac2acb4aca6165eb3504cc8bf491c8ff5
Author:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
AuthorDate: Wed Aug 15 17:47:23 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:48:22 2018 +0200

    oox: make linking work with TLS = openssl
    
    Change-Id: I54b114235dbac276778776f5e08636c39ba3d0fb

diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index 45f4b9cc494a..edea8d9e0282 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -288,4 +288,10 @@ $(eval $(call gb_Library_add_generated_exception_objects,oox,\
     CustomTarget/oox/generated/misc/vmlexport-shape-types \
 ))
 
+ifeq ($(OS),LINUX)
+$(eval $(call gb_Library_add_libs,oox,\
+	-ldl \
+))
+endif
+
 # vim: set noet sw=4 ts=4:
commit 40a51686ed0d0f44477b2b1d651f815e4adbd117
Author:     Michael Stahl <mstahl at redhat.com>
AuthorDate: Mon Mar 7 23:04:37 2016 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 19 01:48:21 2018 +0200

    openssl: fix WNT build
    
    For reasons beyond human understanding, the many-tentacled horror that
    openssl calls its build system puts headers in "inc32" directory on
    Windows and "include" on other platforms in 1.0.2g.
    
    (cherry picked from commit a420a4346ec21ea561f1321767d6a5eed98df02b)
    
    Conflicts:
            external/openssl/ExternalProject_openssl.mk
    
    Change-Id: If03c80f5a31bb6e378cd187051b020579af7f7bd

diff --git a/external/openssl/ExternalProject_openssl.mk b/external/openssl/ExternalProject_openssl.mk
index 4c2d305bbf47..68cd4df2f873 100644

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list