[Libreoffice-commits] core.git: Branch 'distro/mimo/mimo-5-4-7-2' - 139 commits - basic/source configure.ac cppcanvas/source download.lst drawinglayer/source external/curl external/expat external/icu external/lcms2 external/liborcus external/libxml2 external/libxslt external/mdnsresponder external/nss external/openssl external/poppler external/python3 filter/source include/o3tl include/sfx2 librelogo/source oox/source RepositoryExternal.mk sal/textenc sc/qa scripting/source sc/source sdext/source sd/source sfx2/source shell/source starmath/source svl/source svx/source sw/inc sw/qa sw/source vcl/headless vcl/inc vcl/source writerfilter/source xmlsecurity/source
Andras Timar (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 10 20:49:45 UTC 2021
RepositoryExternal.mk | 6
basic/source/comp/scanner.cxx | 2
configure.ac | 7
cppcanvas/source/mtfrenderer/emfplus.cxx | 5
download.lst | 46
drawinglayer/source/texture/texture3d.cxx | 11
external/curl/CVE-2017-1000254.patch | 50
external/curl/CVE-2018-1000120.patch | 67
external/curl/CVE-2018-14618.patch | 66
external/curl/CVE-2018-16890.patch | 39
external/curl/CVE-2019-3822.patch | 35
external/curl/ExternalProject_curl.mk | 1
external/curl/UnpackedTarball_curl.mk | 5
external/expat/ExternalProject_expat.mk | 2
external/expat/StaticLibrary_expat.mk | 1
external/expat/StaticLibrary_expat_x64.mk | 1
external/expat/UnpackedTarball_expat.mk | 1
external/expat/expat-winapi.patch | 18
external/icu/ExternalProject_icu.mk | 5
external/icu/UnpackedTarball_icu.mk | 1
external/icu/b7d08bc04a4296982fcef8b6b8a354a9e4e7afca.patch.2 | 37
external/lcms2/0001-Added-an-extra-check-to-MLU-bounds.patch.1 | 25
external/lcms2/0017-Upgrade-Visual-studio-2017-15.8.patch.1 | 172
external/lcms2/UnpackedTarball_lcms2.mk | 2
external/liborcus/UnpackedTarball_liborcus.mk | 4
external/liborcus/allow-utf-8-in-xml-names.patch | 289
external/libxml2/0001-Fix-buffer-size-checks-in-xmlSnprintfElementContent.patch.1 | 116
external/libxml2/0001-Fix-handling-of-parameter-entity-references.patch.1 | 287
external/libxml2/0001-Fix-type-confusion-in-xmlValidateOneNamespace.patch.1 | 43
external/libxml2/0001-Increase-buffer-space-for-port-in-HTTP-redirect-supp.patch.1 | 31
external/libxml2/0001-Prevent-unwanted-external-entity-reference.patch.1 | 35
external/libxml2/ExternalPackage_xml2.mk | 2
external/libxml2/ExternalProject_xml2.mk | 3
external/libxml2/UnpackedTarball_xml2.mk | 6
external/libxml2/libxml2-android.patch | 16
external/libxml2/libxml2-config.patch.1 | 46
external/libxml2/libxml2-global-symbols.patch | 4
external/libxml2/libxml2-icu.patch.0 | 15
external/libxml2/libxml2-vc10.patch | 2
external/libxml2/ubsan.patch.0 | 84
external/libxslt/ExternalPackage_xslt.mk | 4
external/libxslt/UnpackedTarball_xslt.mk | 3
external/libxslt/e2584eed1c84c18f16e42188c30d2c3d8e3e8853.patch.1 | 69
external/libxslt/libxslt-config.patch.1 | 18
external/libxslt/libxslt-internal-symbols.patch | 64
external/libxslt/libxslt-internal-symbols.patch.1 | 13
external/libxslt/libxslt-msvc.patch.2 | 2
external/mdnsresponder/UnpackedTarball_mDNSResponder.mk | 5
external/mdnsresponder/mDNSResponder_Win32_SOCKET.patch.1 | 85
external/mdnsresponder/mDNSResponder_Win32_buildfix.patch.1 | 16
external/nss/ExternalProject_nss.mk | 6
external/nss/UnpackedTarball_nss.mk | 33
external/nss/clang-cl.patch.0 | 16
external/nss/nsinstall.py | 7
external/nss/nss-3.13.5-zlib-werror.patch | 7
external/nss/nss-chromium-nss-static.patch | 487 -
external/nss/nss-more-static.patch | 39
external/nss/nss-win32-make.patch.1 | 2
external/nss/nss.aix.patch | 2
external/nss/nss.patch | 125
external/nss/nss.vs2015.patch | 10
external/nss/nss.vs2015.pdb.patch | 4
external/nss/nss.windows.patch | 4
external/openssl/ExternalProject_openssl.mk | 2
external/poppler/0001-Partially-revert-814fbda28cc8a37fed3134c2db8da28f86f.patch.1 | 999 ++
external/poppler/0001-Revert-Make-the-mul-tables-be-calculated-at-compile-.patch.1 | 169
external/poppler/ExternalProject_poppler.mk | 51
external/poppler/Module_poppler.mk | 2
external/poppler/StaticLibrary_poppler.mk | 157
external/poppler/UnpackedTarball_poppler.mk | 18
external/poppler/poppler-c++11.patch.1 | 31
external/poppler/poppler-config.patch.1 | 457 +
external/poppler/poppler-libjpeg.patch.1 | 23
external/poppler/poppler-mac-fake.patch.1 | 13
external/poppler/poppler-notests.patch.1 | 11
external/poppler/ubsan.patch.0 | 228
external/python3/0001-3.6-bpo-17239-Disable-external-entities-in-SAX-parse.patch.1 | 59
external/python3/0001-3.6-closes-bpo-42938-Replace-snprintf-with-Python-un.patch.1 | 175
external/python3/ExternalPackage_python3.mk | 1
external/python3/ExternalProject_python3.mk | 6
external/python3/UnpackedTarball_python3.mk | 3
external/python3/python-3.3.5-pyexpat-symbols.patch.1 | 28
filter/source/msfilter/msdffimp.cxx | 6
filter/source/xsltfilter/OleHandler.cxx | 2
include/o3tl/make_unique.hxx | 19
include/sfx2/objsh.hxx | 2
librelogo/source/LibreLogo/LibreLogo.py | 51
oox/source/crypto/CryptTools.cxx | 2
oox/source/drawingml/shapecontext.cxx | 4
oox/source/shape/WpsContext.cxx | 13
oox/source/vml/vmlshape.cxx | 3
sal/textenc/tcvtkr6.tab | 2
sc/qa/unit/data/xls/forcepoint-pivot-1.xls |binary
sc/source/core/data/column3.cxx | 2
sc/source/core/data/document.cxx | 2
sc/source/core/data/dptabres.cxx | 8
sc/source/filter/excel/xipivot.cxx | 8
sc/source/filter/rtf/eeimpars.cxx | 2
sc/source/filter/xml/XMLTableShapeImportHelper.cxx | 2
sc/source/ui/docshell/docsh.cxx | 13
sc/source/ui/docshell/docsh4.cxx | 61
sc/source/ui/docshell/externalrefmgr.cxx | 62
sc/source/ui/inc/docsh.hxx | 2
scripting/source/protocolhandler/scripthandler.cxx | 9
scripting/source/pyprov/pythonscript.py | 45
sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx | 2
sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx | 94
sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx | 71
sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx | 6
sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx | 8
sfx2/source/doc/objmisc.cxx | 52
sfx2/source/notify/eventsupplier.cxx | 18
shell/source/unix/exec/shellexec.cxx | 41
shell/source/win32/SysShExec.cxx | 144
starmath/source/mathtype.cxx | 4
svl/source/numbers/zformat.cxx | 4
svx/source/svdraw/svdopath.cxx | 3
sw/inc/anchoredobject.hxx | 1
sw/inc/unosett.hxx | 2
sw/qa/core/data/odt/fail/forcepoint-xstor-1.odt |binary
sw/qa/core/data/ooxml/fail/ofz9934-1.docx |binary
sw/qa/core/data/rtf/fail/forcepoint-4.rtf | 1779 +++++
sw/qa/core/data/ww8/fail/forcepoint-44.doc |binary
sw/qa/core/data/ww8/indeterminate/ofz7322-1.doc |binary
sw/qa/core/data/ww8/pass/forcepoint-layout-1.doc |binary
sw/qa/extras/layout/data/forcepoint76-1.rtf | 3388 ++++++++++
sw/qa/extras/layout/layout.cxx | 5
sw/qa/extras/uiwriter/data/tdf114536.odt |binary
sw/qa/extras/uiwriter/uiwriter.cxx | 9
sw/source/core/doc/DocumentRedlineManager.cxx | 4
sw/source/core/doc/docbm.cxx | 9
sw/source/core/inc/frame.hxx | 2
sw/source/core/inc/ftnfrm.hxx | 1
sw/source/core/inc/layouter.hxx | 4
sw/source/core/layout/anchoredobject.cxx | 9
sw/source/core/layout/calcmove.cxx | 1
sw/source/core/layout/flowfrm.cxx | 4
sw/source/core/layout/fly.cxx | 3
sw/source/core/layout/ftnfrm.cxx | 29
sw/source/core/layout/layouter.cxx | 15
sw/source/core/layout/objstmpconsiderwrapinfl.cxx | 27
sw/source/core/layout/objstmpconsiderwrapinfl.hxx | 1
sw/source/core/layout/pagechg.cxx | 2
sw/source/core/layout/ssfrm.cxx | 5
sw/source/core/layout/tabfrm.cxx | 5
sw/source/core/layout/trvlfrm.cxx | 8
sw/source/core/text/itrform2.cxx | 13
sw/source/core/text/porfld.cxx | 4
sw/source/core/text/porfld.hxx | 1
sw/source/core/text/txtfld.cxx | 12
sw/source/core/unocore/unosett.cxx | 15
sw/source/core/unocore/unostyle.cxx | 3
sw/source/filter/ww8/ww8graf.cxx | 13
sw/source/filter/ww8/ww8par.cxx | 4
sw/source/filter/ww8/ww8par.hxx | 2
sw/source/filter/ww8/ww8par3.cxx | 2
sw/source/filter/ww8/ww8par5.cxx | 9
sw/source/uibase/config/StoredChapterNumbering.cxx | 2
vcl/headless/svpgdi.cxx | 15
vcl/inc/regionband.hxx | 3
vcl/source/gdi/CommonSalLayout.cxx | 9
vcl/source/gdi/region.cxx | 8
vcl/source/gdi/regionband.cxx | 27
writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 7
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 28
writerfilter/source/ooxml/OOXMLDocumentImpl.cxx | 6
writerfilter/source/ooxml/OOXMLStreamImpl.cxx | 20
writerfilter/source/rtftok/rtfsdrimport.cxx | 2
xmlsecurity/source/helper/xmlsignaturehelper.cxx | 30
xmlsecurity/source/xmlsec/nss/nssinitializer.cxx | 14
170 files changed, 9234 insertions(+), 2137 deletions(-)
New commits:
commit 3e4f0b55ec965270a4d47840acb18213e2934aba
Author: Andras Timar <andras.timar at collabora.com>
AuthorDate: Mon May 10 22:48:59 2021 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 10 22:48:59 2021 +0200
Bump version to 5.4.7.2.M7
Change-Id: I0e5314312bbefd3bd59cd39f0f8b876de8463e25
diff --git a/configure.ac b/configure.ac
index 9c25ac076c8c..bab32d23e6fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ dnl in order to create a configure script.
# several non-alphanumeric characters, those are split off and used only for the
# ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
-AC_INIT([LibreOffice],[5.4.7.2.M6],[],[],[http://documentfoundation.org/])
+AC_INIT([LibreOffice],[5.4.7.2.M7],[],[],[http://documentfoundation.org/])
AC_PREREQ([2.59])
commit 26d1ebf04f8383e07aa70ad6245019ee2e1dc9d0
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Apr 29 20:10:34 2021 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 10 22:15:39 2021 +0200
allow utf-8 in xml names (liborcus) (tdf#141672)
Change-Id: Ib150d55b588a572e4352396f18de2331983b2aae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114892
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/external/liborcus/UnpackedTarball_liborcus.mk b/external/liborcus/UnpackedTarball_liborcus.mk
index 791436e66016..6df45cb2fb39 100644
--- a/external/liborcus/UnpackedTarball_liborcus.mk
+++ b/external/liborcus/UnpackedTarball_liborcus.mk
@@ -21,6 +21,10 @@ $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
external/liborcus/0001-protect-the-self-closing-xml-element-code-against-se.patch \
))
+$(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
+ external/liborcus/allow-utf-8-in-xml-names.patch \
+))
+
ifeq ($(OS),WNT)
$(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
external/liborcus/windows-constants-hack.patch \
diff --git a/external/liborcus/allow-utf-8-in-xml-names.patch b/external/liborcus/allow-utf-8-in-xml-names.patch
new file mode 100644
index 000000000000..efef24b84053
--- /dev/null
+++ b/external/liborcus/allow-utf-8-in-xml-names.patch
@@ -0,0 +1,289 @@
+From 9889cb660372bc6c3da22fc274c73ea11040415f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak at centrum.cz>
+Date: Thu, 29 Apr 2021 19:12:20 +0200
+Subject: [PATCH] allow utf-8 in xml names (#137)
+
+https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NameStartChar
+has a list of all allowed characters.
+---
+ include/orcus/sax_parser_base.hpp | 3 +
+ src/orcus_test_xml.cpp | 1 +
+ src/parser/sax_parser_base.cpp | 186 ++++++++++++++++++++++++++++--
+ test/xml/non-ascii/check.txt | 4 +
+ test/xml/non-ascii/input.xml | 4 +
+ 5 files changed, 190 insertions(+), 8 deletions(-)
+ create mode 100644 test/xml/non-ascii/check.txt
+ create mode 100644 test/xml/non-ascii/input.xml
+
+diff --git a/include/orcus/sax_parser_base.hpp b/include/orcus/sax_parser_base.hpp
+index a117b3a2..1aeb8b38 100644
+--- a/include/orcus/sax_parser_base.hpp
++++ b/include/orcus/sax_parser_base.hpp
+@@ -217,6 +217,9 @@ protected:
+ void element_name(parser_element& elem, const char* begin_pos);
+ void attribute_name(pstring& attr_ns, pstring& attr_name);
+ void characters_with_encoded_char(cell_buffer& buf);
++
++ int is_name_char();
++ int is_name_start_char();
+ };
+
+ }}
+diff --git a/src/orcus_test_xml.cpp b/src/orcus_test_xml.cpp
+index 98e83297..89c8af72 100644
+--- a/src/orcus_test_xml.cpp
++++ b/src/orcus_test_xml.cpp
+@@ -73,6 +73,7 @@ const char* sax_parser_test_dirs[] = {
+ SRCDIR"/test/xml/bom/",
+ SRCDIR"/test/xml/custom-decl-1/",
+ SRCDIR"/test/xml/cdata-1/"
++ SRCDIR"/test/xml/non-ascii/",
+ };
+
+ const char* sax_parser_parse_only_test_dirs[] = {
+diff --git a/src/parser/sax_parser_base.cpp b/src/parser/sax_parser_base.cpp
+index 743130da..ecbd7f99 100644
+--- a/src/parser/sax_parser_base.cpp
++++ b/src/parser/sax_parser_base.cpp
+@@ -296,20 +296,22 @@ void parser_base::value_with_encoded_char(cell_buffer& buf, pstring& str)
+ str = pstring(buf.get(), buf.size());
+
+ // Skip the closing quote.
+- assert(cur_char() == '"');
++ assert(!has_char() || cur_char() == '"');
+ next();
+ }
+
+ bool parser_base::value(pstring& str, bool decode)
+ {
+ char c = cur_char();
+- if (c != '"')
++ if (c != '"' && c != '\'')
+ throw malformed_xml_error("value must be quoted", offset());
+
++ char quote_char = c;
++
+ c = next_char_checked();
+
+ const char* p0 = mp_char;
+- for (; c != '"'; c = next_char_checked())
++ for (; c != quote_char; c = next_char_checked())
+ {
+ if (decode && c == '&')
+ {
+@@ -330,19 +332,187 @@ bool parser_base::value(pstring& str, bool decode)
+ return false;
+ }
+
++// https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NameStartChar
++// Return length of the character in bytes, otherwise 0.
++template< bool only_start_name >
++static
++int is_name_char_helper(const char* mp_char, const char* mp_end)
++{
++ const unsigned char first = mp_char[0];
++ // Note that ':' technically is an allowed name character, but it is handled separately
++ // e.g. in element_name(), so here pretend it isn't.
++ if (/*first == ':' ||*/ first == '_' || (first >= 'A' && first <= 'Z') || (first >= 'a' && first <= 'z'))
++ return 1;
++ if (!only_start_name && (first == '-' || first == '.' || (first >= '0' && first <= '9')))
++ return 1;
++
++ if (first < 0x7f) // other ascii characters are not allowed
++ return 0;
++ if (mp_end < mp_char + 1)
++ return 0;
++ const unsigned char second = mp_char[1];
++
++ // 0xb7 = 0xc2 0xb7 utf-8
++ if (!only_start_name && first == 0xc2 && second == 0xb7)
++ return 2;
++
++ // [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF]
++ // 0xc0 = 0xc3 0x80 utf-8
++ if (first < 0xc3)
++ return 0;
++ // xd7 = 0xc3 0x97 utf-8, 0xf7 = 0xc3 0xb7 utf-8
++ if (first == 0xc3)
++ return second >= 0x80 && second <= 0xff && second != 0x97 && second != 0xb7 ? 2 : 0;
++ // 0x2ff = 0xcb 0xbf utf-8, 0x300 = 0xcc 0x80 utf-8
++ if (first >= 0xc4 && first <= 0xcb)
++ return 2;
++
++ // [#x0300-#x036F]
++ // 0x0300 = 0xcc 0x80 utf-8, 0x36f = 0xcd 0xaf utf-8
++ if (!only_start_name && first == 0xcc)
++ return 2;
++ if (!only_start_name && first == 0xcd && second <= 0xaf)
++ return 2;
++
++ // [#x370-#x37D] | [#x37F-#x1FFF]
++ // 0x370 = 0xcd 0xb0 utf-8, 0x37e = 0xcd 0xbe
++ if (first < 0xcd)
++ return 0;
++ if (first == 0xcd)
++ return second >= 0xb0 && second != 0xbe ? 2 : 0;
++ // 0x07ff = 0xdf 0xbf utf-8 (the last 2-byte utf-8)
++ if (first <= 0xdf)
++ return 2;
++
++ if (first < 0xe0)
++ return 0;
++ if (mp_end < mp_char + 2)
++ return 0;
++ const unsigned char third = mp_char[2];
++
++ // 0x0800 = 0xe0 0xa0 0x80 utf-8, 0x1fff = 0xe1 0xbf 0xbf utf-8, 0x2000 = 0xe2 0x80 0x80
++ if (first == 0xe0 || first == 0xe1)
++ return 3;
++
++ // [#x200C-#x200D]
++ // 0x200c = 0xe2 0x80 0x8c utf-8, 0x200d = 0xe2 0x80 0x8d utf-8
++ if (first < 0xe2)
++ return 0;
++ if (first == 0xe2 && second == 0x80 && (third == 0x8c || third == 0x8d))
++ return 3;
++
++ // [#x203F-#x2040]
++ // 0x203f = 0xe2 0x80 0xbf utf-8, 0x2040 = 0xe2 0x81 0x80 utf-8
++ if (!only_start_name && first == 0xe2 && second == 0x80 && third == 0xbf)
++ return 3;
++ if (!only_start_name && first == 0xe2 && second == 0x81 && third == 0x80)
++ return 3;
++
++ // [#x2070-#x218F]
++ // 0x2070 = 0xe2 0x81 0xb0 utf-8, 0x218f = 0xe2 0x86 0x8f utf-8
++ if (first == 0xe2)
++ {
++ if (second < 0x81)
++ return 0;
++ if (second >= 0x81 && second < 0x86)
++ return 3;
++ if (second == 0x86 && third <= 0x8f)
++ return 3;
++ }
++
++ // [#x2C00-#x2FEF]
++ // 0x2c00 = 0xe2 0xb0 0x80 utf-8, 0x2fef = 0xe2 0xbf 0xaf utf-8
++ if (first == 0xe2)
++ {
++ if (second < 0xb0)
++ return 0;
++ if (second < 0xbf)
++ return 3;
++ if (second == 0xbf && third <= 0xaf)
++ return 3;
++ }
++
++ // [#x3001-#xD7FF]
++ // 0x3001 = 0xe3 0x80 0x81 utf-8, 0xd7ff = 0xed 0x9f 0xbf utf-8, 0xd800 = 0xed 0xa0 0x80 utf-8
++ if (first < 0xe3)
++ return 0;
++ if (first < 0xed)
++ return 3;
++ if (first == 0xed && second <= 0x9f)
++ return 3;
++
++ // [#xF900-#xFDCF]
++ // 0xf900 = 0xef 0xa4 0x80 utf-8, 0xfdcf = 0xef 0xb7 0x8f utf-8
++ if (first == 0xef)
++ {
++ if (second < 0xa4)
++ return 0;
++ if (second < 0xb7)
++ return 3;
++ if (second == 0xb7 && third <= 0x8f)
++ return 3;
++ }
++
++ // [#xFDF0-#xFFFD]
++ // 0xfdf0 = 0xef 0xb7 0xb0 utf-8, 0xfffd = 0xef 0xbf 0xbd utf-8
++ if (first == 0xef)
++ {
++ assert(second >= 0xb7);
++ if (second == 0xb7 && third < 0xb0)
++ return 0;
++ if (second < 0xbe)
++ return 3;
++ if (second == 0xbf && third <= 0xbd)
++ return 3;
++ }
++
++ if (first < 0xf0)
++ return 0;
++ if (mp_end < mp_char + 3)
++ return 0;
++ // const unsigned char fourth = mp_char[3];
++
++ // [#x10000-#xEFFFF]
++ // 0x10000 = 0xf0 0x90 0x80 0x80 utf-8, 0xeffff = 0xf3 0xaf 0xbf 0xbf utf-8,
++ // 0xf0000 = 0xf3 0xb0 0x80 0x80 utf-8
++ if (first >= 0xf0 && first < 0xf2)
++ return 4;
++ if (first == 0xf3 && second < 0xb0)
++ return 4;
++
++ return 0;
++}
++
++int parser_base::is_name_char()
++{
++ return is_name_char_helper<false>(mp_char, mp_end);
++}
++
++int parser_base::is_name_start_char()
++{
++ return is_name_char_helper<true>(mp_char, mp_end);
++}
++
+ void parser_base::name(pstring& str)
+ {
+ const char* p0 = mp_char;
+- char c = cur_char();
+- if (!is_alpha(c))
++ int skip = is_name_start_char();
++ if (skip == 0)
+ {
+ ::std::ostringstream os;
+- os << "name must begin with an alphabet, but got this instead '" << c << "'";
++ os << "name must begin with an alphabet, but got this instead '" << cur_char() << "'";
+ throw malformed_xml_error(os.str(), offset());
+ }
++ next(skip);
+
+- while (is_alpha(c) || is_numeric(c) || is_name_char(c))
+- c = next_char_checked();
++ for(;;)
++ {
++ cur_char_checked(); // check end of xml stream
++ skip = is_name_char();
++ if(skip == 0)
++ break;
++ next(skip);
++ }
+
+ str = pstring(p0, mp_char-p0);
+ }
+diff --git a/test/xml/non-ascii/check.txt b/test/xml/non-ascii/check.txt
+new file mode 100644
+index 00000000..77b7c003
+--- /dev/null
++++ b/test/xml/non-ascii/check.txt
+@@ -0,0 +1,4 @@
++/Myšička
++/Myšička at jméno="Žužla"
++/Myšička/Nožičky
++/Myšička/Nožičky"4"
+diff --git a/test/xml/non-ascii/input.xml b/test/xml/non-ascii/input.xml
+new file mode 100644
+index 00000000..c516744b
+--- /dev/null
++++ b/test/xml/non-ascii/input.xml
+@@ -0,0 +1,4 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<Myšička jméno="Žužla">
++ <Nožičky>4</Nožičky>
++</Myšička>
+--
+2.26.2
+
commit 3ae37e476d7192ac7e1ebe515258a5043cafca18
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Feb 16 09:30:09 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 10 22:08:17 2021 +0200
Improve checkExtension
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110970
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Tested-by: Jenkins
(cherry picked from commit f456c4dacf700e064e112ef068ff7edb04239754)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110922
Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
(cherry picked from commit f19d95986756412e5d72047656eec17a720c5e57)
Change-Id: Iff416a9c5930ad5903f7ee51a2abbc94d5f40800
diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx
index 49cd039b5b60..830ef7ec1290 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -389,21 +389,28 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
}
}
pathname = OUSring(SAL_U(path));
+ // ShellExecuteExW appears to ignore trailing dots, so remove them:
+ while (pathname.endsWith(".", &pathname)) {}
auto const n = pathname.lastIndexOf('.');
if (n > pathname.lastIndexOf('\\')) {
auto const ext = pathname.copy(n + 1);
- OUString env;
- if (osl_getEnvironment(OUString("PATHEXT").pData, &env.pData) != osl_Process_E_None)
- {
- SAL_INFO("shell", "osl_getEnvironment(PATHEXT) failed");
- }
- if (!(checkExtension(ext, env)
- && checkExtension(
- ext,
- ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.CLASS;.JAR")))
- {
- throw css::lang::IllegalArgumentException(
- "XSystemShellExecute.execute, cannot process <" + aCommand + ">", {}, 0);
+ if (!ext.isEmpty()) {
+ OUString env;
+ if (osl_getEnvironment(OUString("PATHEXT").pData, &env.pData)
+ != osl_Process_E_None)
+ {
+ SAL_INFO("shell", "osl_getEnvironment(PATHEXT) failed");
+ }
+ if (!(checkExtension(ext, env)
+ && checkExtension(
+ ext,
+ ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.CLASS;"
+ ".JAR;.APPLICATION;.LNK;.SCR")))
+ {
+ throw css::lang::IllegalArgumentException(
+ "XSystemShellExecute.execute, cannot process <" + aCommand + ">", {},
+ 0);
+ }
}
}
}
commit 5b50e28edb4180ef4eeae8df0bf88cbb2a703f6b
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue Jan 28 01:28:24 2020 +0300
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 10 22:06:41 2021 +0200
tdf#130216: normalize paths with .. segments
... which obviously are rejected by SHGetFileInfoW and SHParseDisplayName
that it calls internally.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87565
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87737
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
(cherry picked from commit fc043d38c256243fb782cc48e7708feaeabba4ae)
Change-Id: I2f5f3c675ea6aa1c2d92eef30be4399a8d600255
diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx
index a9e5a2c4ec7d..49cd039b5b60 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -39,6 +39,7 @@
#endif
#include <windows.h>
#include <shellapi.h>
+#include <Shlobj.h>
#include <Shobjidl.h>
#include <objbase.h>
#if defined _MSC_VER
@@ -307,21 +308,33 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
+ "> failed with " + OUString::number(e1)),
{}, 0);
}
+ const int MAX_LONG_PATH = 32767; // max longpath on WinNT
+ if (pathname.getLength() >= MAX_LONG_PATH)
+ {
+ throw css::lang::IllegalArgumentException(
+ "XSystemShellExecute.execute, path <" + pathname + "> too long", {}, 0);
+ }
+ wchar_t path[MAX_LONG_PATH];
+ wcscpy_s(path, SAL_W(pathname.getStr()));
for (int i = 0;; ++i) {
+ // tdf#130216: normalize c:\path\to\something\..\else into c:\path\to\else
+ if (PathResolve(path, nullptr, PRF_VERIFYEXISTS | PRF_REQUIREABSOLUTE) == 0)
+ {
+ throw css::lang::IllegalArgumentException(
+ "XSystemShellExecute.execute, PathResolve(" + OUString(SAL_U(path))
+ + ") failed",
+ {}, 0);
+ }
SHFILEINFOW info;
- if (SHGetFileInfoW(
- SAL_W(pathname.getStr()), 0, &info, sizeof info, SHGFI_EXETYPE)
- != 0)
+ if (SHGetFileInfoW(path, 0, &info, sizeof info, SHGFI_EXETYPE) != 0)
{
throw css::lang::IllegalArgumentException(
"XSystemShellExecute.execute, cannot process <" + aCommand + ">", {}, 0);
}
- if (SHGetFileInfoW(
- SAL_W(pathname.getStr()), 0, &info, sizeof info, SHGFI_ATTRIBUTES)
- == 0)
+ if (SHGetFileInfoW(path, 0, &info, sizeof info, SHGFI_ATTRIBUTES) == 0)
{
throw css::lang::IllegalArgumentException(
- "XSystemShellExecute.execute, SHGetFileInfoW(" + pathname + ") failed", {},
+ "XSystemShellExecute.execute, SHGetFileInfoW(" + OUString(SAL_U(path)) + ") failed", {},
0);
}
if ((info.dwAttributes & SFGAO_LINK) == 0) {
@@ -346,7 +359,7 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
+ o3tl::runtimeToOUString(e3.what())),
{}, 0);
}
- e2 = file->Load(SAL_W(pathname.getStr()), STGM_READ);
+ e2 = file->Load(path, STGM_READ);
if (FAILED(e2)) {
throw css::lang::IllegalArgumentException(
("XSystemShellExecute.execute, IPersistFile.Load failed with "
@@ -360,16 +373,14 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
+ OUString::number(e2)),
{}, 0);
}
- wchar_t path[MAX_PATH];
WIN32_FIND_DATAW wfd;
- e2 = link->GetPath(path, MAX_PATH, &wfd, SLGP_RAWPATH);
+ e2 = link->GetPath(path, SAL_N_ELEMENTS(path), &wfd, SLGP_RAWPATH);
if (FAILED(e2)) {
throw css::lang::IllegalArgumentException(
("XSystemShellExecute.execute, IShellLink.GetPath failed with "
+ OUString::number(e2)),
{}, 0);
}
- pathname = SAL_U(path);
// Fail at some arbitrary nesting depth, to avoid an infinite loop:
if (i == 30) {
throw css::lang::IllegalArgumentException(
@@ -377,6 +388,7 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
{}, 0);
}
}
+ pathname = OUSring(SAL_U(path));
auto const n = pathname.lastIndexOf('.');
if (n > pathname.lastIndexOf('\\')) {
auto const ext = pathname.copy(n + 1);
commit af298cd3fd3b084535e578a19ac3c3b0fdd8337c
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Nov 25 09:13:12 2020 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 10 22:01:15 2021 +0200
Better handling of Java files
Change-Id: Ifa662be39ac7d35241ee31956e2556b7ba3b5a02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106558
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
(cherry picked from commit 696739056f37430154d6333b8f7228d1c44d09b3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106520
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit ec5adc39cbea6d754ef68ab3d03fb16066b27e40)
diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx
index 56487a220b68..5eab98b926a5 100644
--- a/shell/source/unix/exec/shellexec.cxx
+++ b/shell/source/unix/exec/shellexec.cxx
@@ -155,6 +155,10 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar
{
throw css::lang::IllegalArgumentException(
"XSystemShellExecute.execute, cannot process <" + aCommand + ">", {}, 0);
+ } else if (pathname.endsWithIgnoreAsciiCase(".class")
+ || pathname.endsWithIgnoreAsciiCase(".jar"))
+ {
+ dir = true;
}
}
diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx
index f18022897e7f..a9e5a2c4ec7d 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -387,7 +387,8 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
}
if (!(checkExtension(ext, env)
&& checkExtension(
- ext, ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY")))
+ ext,
+ ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.CLASS;.JAR")))
{
throw css::lang::IllegalArgumentException(
"XSystemShellExecute.execute, cannot process <" + aCommand + ">", {}, 0);
commit 8689c367a9f6114b25347890249a1a54db899099
Author: David Tardon <dtardon at redhat.com>
AuthorDate: Wed Nov 8 19:35:12 2017 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 10 21:44:52 2021 +0200
upload neon 0.30.2
Change-Id: Iad3719ad03fa1bdec2e31b4cc972594791cd5788
Reviewed-on: https://gerrit.libreoffice.org/44515
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: David Tardon <dtardon at redhat.com>
diff --git a/download.lst b/download.lst
index 8531c2395029..376f8b7f3fd2 100644
--- a/download.lst
+++ b/download.lst
@@ -162,8 +162,8 @@ export MYSQLCPPCONN_SHA256SUM := a25f14dad39e93a2f9cdf09166ee53981f7212dce829e42
export MYSQLCPPCONN_TARBALL := 7239a4430efd4d0189c4f24df67f08e5-mysql-connector-c++-1.1.4.tar.gz
export MYTHES_SHA256SUM := 1e81f395d8c851c3e4e75b568e20fa2fa549354e75ab397f9de4b0e0790a305f
export MYTHES_TARBALL := a8c2c5b8f09e7ede322d5c602ff6a4b6-mythes-1.2.4.tar.gz
-export NEON_SHA256SUM := 00c626c0dc18d094ab374dbd9a354915bfe4776433289386ed489c2ec0845cdd
-export NEON_TARBALL := 231adebe5c2f78fded3e3df6e958878e-neon-0.30.1.tar.gz
+export NEON_SHA256SUM := db0bd8cdec329b48f53a6f00199c92d5ba40b0f015b153718d1b15d3d967fbca
+export NEON_TARBALL := neon-0.30.2.tar.gz
export NSS_SHA256SUM := ec6032d78663c6ef90b4b83eb552dedf721d2bce208cec3bf527b8f637db7e45
export NSS_TARBALL := nss-3.55-with-nspr-4.27.tar.gz
export ODFGEN_SHA256SUM := 2c7b21892f84a4c67546f84611eccdad6259875c971e98ddb027da66ea0ac9c2
commit 8abfdc1861dfa88c1572ac46d3aea3fce5e0d35d
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Apr 7 12:19:43 2018 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 10 19:47:20 2021 +0200
external/python3: Drop nis.cpython-*m.so
At least Fedora 28 glibc-2.27-8.fc28 no longer provides the nis development
headers and libraries. (It only still contains some binaries for backwards
compatibility, in the libnsl sub-package: "This package provides the legacy
version of libnsl library, for accessing NIS services.")
There is probably no real need to have nis.cpython-*m.so contained in
external/python3/ExternalPackage_python3.mk (it probably just happened to build
fine when that list was originally created, so was included).
Change-Id: Ic6128fd872432005c0ded76640c5b56781ca69a1
Reviewed-on: https://gerrit.libreoffice.org/52535
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/external/python3/ExternalPackage_python3.mk b/external/python3/ExternalPackage_python3.mk
index 8617e0efb34f..dc3d739c295b 100644
--- a/external/python3/ExternalPackage_python3.mk
+++ b/external/python3/ExternalPackage_python3.mk
@@ -83,7 +83,6 @@ $(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-cor
LO_lib/mmap.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
LO_lib/_multibytecodec.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
LO_lib/_multiprocessing.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
- LO_lib/nis.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
LO_lib/_opcode.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
LO_lib/ossaudiodev.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
LO_lib/parser.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
commit d5a41eef1a6713d606859932c249f513f816c94a
Author: Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Wed Feb 17 12:24:08 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 10 17:40:36 2021 +0200
python3: add patch for CVE-2021-3177
Looks like Python 3.5 is EOL, so backport the patch.
Change-Id: I9ba397b3ed7e5f4ee4f78b144d822ce260ca9fb4
diff --git a/external/python3/0001-3.6-closes-bpo-42938-Replace-snprintf-with-Python-un.patch.1 b/external/python3/0001-3.6-closes-bpo-42938-Replace-snprintf-with-Python-un.patch.1
new file mode 100644
index 000000000000..fdcc5cb65267
--- /dev/null
+++ b/external/python3/0001-3.6-closes-bpo-42938-Replace-snprintf-with-Python-un.patch.1
@@ -0,0 +1,175 @@
+From 34df10a9a16b38d54421eeeaf73ec89828563be7 Mon Sep 17 00:00:00 2001
+From: Benjamin Peterson <benjamin at python.org>
+Date: Mon, 18 Jan 2021 15:11:46 -0600
+Subject: [PATCH] [3.6] closes bpo-42938: Replace snprintf with Python unicode
+ formatting in ctypes param reprs. (GH-24250)
+
+(cherry picked from commit 916610ef90a0d0761f08747f7b0905541f0977c7)
+
+Co-authored-by: Benjamin Peterson <benjamin at python.org>
+---
+ Lib/ctypes/test/test_parameters.py | 43 +++++++++++++++
+ .../2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst | 2 +
+ Modules/_ctypes/callproc.c | 55 +++++++------------
+ 3 files changed, 66 insertions(+), 34 deletions(-)
+ create mode 100644 Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst
+
+diff --git a/Lib/ctypes/test/test_parameters.py b/Lib/ctypes/test/test_parameters.py
+index e4c25fd880..531894fdec 100644
+--- a/Lib/ctypes/test/test_parameters.py
++++ b/Lib/ctypes/test/test_parameters.py
+@@ -201,6 +201,49 @@ def __dict__(self):
+ self.assertRaises(ArgumentError, func, 99)
+
+
++ def test_parameter_repr(self):
++ from ctypes import (
++ c_bool,
++ c_char,
++ c_wchar,
++ c_byte,
++ c_ubyte,
++ c_short,
++ c_ushort,
++ c_int,
++ c_uint,
++ c_long,
++ c_ulong,
++ c_longlong,
++ c_ulonglong,
++ c_float,
++ c_double,
++ c_longdouble,
++ c_char_p,
++ c_wchar_p,
++ c_void_p,
++ )
++ self.assertRegex(repr(c_bool.from_param(True)), r"^<cparam '\?' at 0x[A-Fa-f0-9]+>$")
++ self.assertEqual(repr(c_char.from_param(97)), "<cparam 'c' ('a')>")
++ self.assertRegex(repr(c_wchar.from_param('a')), r"^<cparam 'u' at 0x[A-Fa-f0-9]+>$")
++ self.assertEqual(repr(c_byte.from_param(98)), "<cparam 'b' (98)>")
++ self.assertEqual(repr(c_ubyte.from_param(98)), "<cparam 'B' (98)>")
++ self.assertEqual(repr(c_short.from_param(511)), "<cparam 'h' (511)>")
++ self.assertEqual(repr(c_ushort.from_param(511)), "<cparam 'H' (511)>")
++ self.assertRegex(repr(c_int.from_param(20000)), r"^<cparam '[li]' \(20000\)>$")
++ self.assertRegex(repr(c_uint.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$")
++ self.assertRegex(repr(c_long.from_param(20000)), r"^<cparam '[li]' \(20000\)>$")
++ self.assertRegex(repr(c_ulong.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$")
++ self.assertRegex(repr(c_longlong.from_param(20000)), r"^<cparam '[liq]' \(20000\)>$")
++ self.assertRegex(repr(c_ulonglong.from_param(20000)), r"^<cparam '[LIQ]' \(20000\)>$")
++ self.assertEqual(repr(c_float.from_param(1.5)), "<cparam 'f' (1.5)>")
++ self.assertEqual(repr(c_double.from_param(1.5)), "<cparam 'd' (1.5)>")
++ self.assertEqual(repr(c_double.from_param(1e300)), "<cparam 'd' (1e+300)>")
++ self.assertRegex(repr(c_longdouble.from_param(1.5)), r"^<cparam ('d' \(1.5\)|'g' at 0x[A-Fa-f0-9]+)>$")
++ self.assertRegex(repr(c_char_p.from_param(b'hihi')), "^<cparam 'z' \(0x[A-Fa-f0-9]+\)>$")
++ self.assertRegex(repr(c_wchar_p.from_param('hihi')), "^<cparam 'Z' \(0x[A-Fa-f0-9]+\)>$")
++ self.assertRegex(repr(c_void_p.from_param(0x12)), r"^<cparam 'P' \(0x0*12\)>$")
++
+ ################################################################
+
+ if __name__ == '__main__':
+diff --git a/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst b/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst
+new file mode 100644
+index 0000000000..7df65a156f
+--- /dev/null
++++ b/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst
+@@ -0,0 +1,2 @@
++Avoid static buffers when computing the repr of :class:`ctypes.c_double` and
++:class:`ctypes.c_longdouble` values.
+diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
+index 70e416b950..9fcf95f543 100644
+--- a/Modules/_ctypes/callproc.c
++++ b/Modules/_ctypes/callproc.c
+@@ -451,54 +451,43 @@ PyCArg_dealloc(PyCArgObject *self)
+ static PyObject *
+ PyCArg_repr(PyCArgObject *self)
+ {
+- char buffer[256];
+ switch(self->tag) {
+ case 'b':
+ case 'B':
+- sprintf(buffer, "<cparam '%c' (%d)>",
++ return PyUnicode_FromFormat("<cparam '%c' (%d)>",
+ self->tag, self->value.b);
+- break;
+ case 'h':
+ case 'H':
+- sprintf(buffer, "<cparam '%c' (%d)>",
++ return PyUnicode_FromFormat("<cparam '%c' (%d)>",
+ self->tag, self->value.h);
+- break;
+ case 'i':
+ case 'I':
+- sprintf(buffer, "<cparam '%c' (%d)>",
++ return PyUnicode_FromFormat("<cparam '%c' (%d)>",
+ self->tag, self->value.i);
+- break;
+ case 'l':
+ case 'L':
+- sprintf(buffer, "<cparam '%c' (%ld)>",
++ return PyUnicode_FromFormat("<cparam '%c' (%ld)>",
+ self->tag, self->value.l);
+- break;
+
+ #ifdef HAVE_LONG_LONG
+ case 'q':
+ case 'Q':
+- sprintf(buffer,
+-#ifdef MS_WIN32
+- "<cparam '%c' (%I64d)>",
+-#else
+- "<cparam '%c' (%qd)>",
+-#endif
++ return PyUnicode_FromFormat("<cparam '%c' (%qd)>",
+ self->tag, self->value.q);
+- break;
+ #endif
+ case 'd':
+- sprintf(buffer, "<cparam '%c' (%f)>",
+- self->tag, self->value.d);
+- break;
+- case 'f':
+- sprintf(buffer, "<cparam '%c' (%f)>",
+- self->tag, self->value.f);
+- break;
+-
++ case 'f': {
++ PyObject *f = PyFloat_FromDouble((self->tag == 'f') ? self->value.f : self->value.d);
++ if (f == NULL) {
++ return NULL;
++ }
++ { PyObject *result = PyUnicode_FromFormat("<cparam '%c' (%R)>", self->tag, f);
++ Py_DECREF(f);
++ return result; }
++ }
+ case 'c':
+- sprintf(buffer, "<cparam '%c' (%c)>",
++ return PyUnicode_FromFormat("<cparam '%c' ('%c')>",
+ self->tag, self->value.c);
+- break;
+
+ /* Hm, are these 'z' and 'Z' codes useful at all?
+ Shouldn't they be replaced by the functionality of c_string
+@@ -507,16 +495,14 @@ PyCArg_repr(PyCArgObject *self)
+ case 'z':
+ case 'Z':
+ case 'P':
+- sprintf(buffer, "<cparam '%c' (%p)>",
++ return PyUnicode_FromFormat("<cparam '%c' (%p)>",
+ self->tag, self->value.p);
+ break;
+
+ default:
+- sprintf(buffer, "<cparam '%c' at %p>",
+- self->tag, self);
+- break;
++ return PyUnicode_FromFormat("<cparam '%c' at %p>",
++ (unsigned char)self->tag, (void *)self);
+ }
+- return PyUnicode_FromString(buffer);
+ }
+
+ static PyMemberDef PyCArgType_members[] = {
+--
+2.29.2
+
diff --git a/external/python3/UnpackedTarball_python3.mk b/external/python3/UnpackedTarball_python3.mk
index ee99de1f5e0c..81a392f76f48 100644
--- a/external/python3/UnpackedTarball_python3.mk
+++ b/external/python3/UnpackedTarball_python3.mk
@@ -26,6 +26,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,python3,\
external/python3/ubsan.patch.0 \
external/python3/python-3.5.tweak.strip.soabi.patch \
external/python3/0001-3.6-bpo-17239-Disable-external-entities-in-SAX-parse.patch.1 \
+ external/python3/0001-3.6-closes-bpo-42938-Replace-snprintf-with-Python-un.patch.1 \
))
ifneq ($(filter DRAGONFLY FREEBSD LINUX NETBSD OPENBSD SOLARIS,$(OS)),)
commit ec698b6b1dbe4f1cb2e90f483c6d37a89007f6e0
Author: Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Wed Jan 6 19:30:07 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 10 16:53:49 2021 +0200
poppler: upgrade to release 21.01.0
Fixes CVE-2020-27778, CVE-2020-35702
and changelogs mention lots of fuzzing fixes.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108912
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
(cherry picked from commit 48e8b32a9b66722bbb28fc15840b3706a461aeb7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108904
Tested-by: Michael Stahl <michael.stahl at allotropia.de>
Reviewed-by: Thorsten Behrens <thorsten.behrens at allotropia.de>
(cherry picked from commit fb185106492f5aabac6ab57ae90cd81d51480093)
Change-Id: Ib07bdee726905e74afc13a01bbbd53f218121744
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108956
Tested-by: Thorsten Behrens <thorsten.behrens at allotropia.de>
Reviewed-by: Thorsten Behrens <thorsten.behrens at allotropia.de>
diff --git a/download.lst b/download.lst
index 1f6503badec7..8531c2395029 100644
--- a/download.lst
+++ b/download.lst
@@ -191,8 +191,8 @@ export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3
export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
export PNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
export PNG_TARBALL := libpng-1.6.37.tar.xz
-export POPPLER_SHA256SUM := 234f8e573ea57fb6a008e7c1e56bfae1af5d1adf0e65f47555e1ae103874e4df
-export POPPLER_TARBALL := poppler-0.82.0.tar.xz
+export POPPLER_SHA256SUM := 016dde34e5f868ea98a32ca99b643325a9682281500942b7113f4ec88d20e2f3
+export POPPLER_TARBALL := poppler-21.01.0.tar.xz
export POSTGRESQL_SHA256SUM := db61d498105a7d5fe46185e67ac830c878cdd7dc1f82a87f06b842217924c461
export POSTGRESQL_TARBALL := c0b4799ea9850eae3ead14f0a60e9418-postgresql-9.2.1.tar.bz2
export PYTHON_SHA256SUM := c24a37c63a67f53bdd09c5f287b5cff8e8b98f857bf348c577d454d3f74db049
diff --git a/external/poppler/0001-Partially-revert-814fbda28cc8a37fed3134c2db8da28f86f.patch.1 b/external/poppler/0001-Partially-revert-814fbda28cc8a37fed3134c2db8da28f86f.patch.1
new file mode 100644
index 000000000000..05b2346d131f
--- /dev/null
+++ b/external/poppler/0001-Partially-revert-814fbda28cc8a37fed3134c2db8da28f86f.patch.1
@@ -0,0 +1,999 @@
+[PATCH] Partially revert 814fbda28cc8a37fed3134c2db8da28f86fb5ee0
+
+"Run clang-format" in poppler/Decrypt.cc
+---
+ poppler/Decrypt.cc | 848 +++++++++++++++++++++++----------------------
+ 1 file changed, 437 insertions(+), 411 deletions(-)
+
+diff --git a/poppler/Decrypt.cc b/poppler/Decrypt.cc
+index 62b11702..4b388ab9 100644
+--- a/poppler/Decrypt.cc
++++ b/poppler/Decrypt.cc
+@@ -599,139 +599,167 @@ static unsigned char rc4DecryptByte(unsigned char *state, unsigned char *x, unsi
+ // Returns false if EOF was reached, true otherwise
+ static bool aesReadBlock(Stream *str, unsigned char *in, bool addPadding)
+ {
+- int c, i;
++ int c, i;
+
+- for (i = 0; i < 16; ++i) {
+- if ((c = str->getChar()) != EOF) {
+- in[i] = (unsigned char)c;
+- } else {
+- break;
+- }
++ for (i = 0; i < 16; ++i) {
++ if ((c = str->getChar()) != EOF) {
++ in[i] = (unsigned char)c;
++ } else {
++ break;
+ }
++ }
+
+- if (i == 16) {
+- return true;
+- } else {
+- if (addPadding) {
+- c = 16 - i;
+- while (i < 16) {
+- in[i++] = (unsigned char)c;
+- }
+- }
+- return false;
++ if (i == 16) {
++ return true;
++ } else {
++ if (addPadding) {
++ c = 16 - i;
++ while (i < 16) {
++ in[i++] = (unsigned char)c;
++ }
+ }
++ return false;
++ }
+ }
+
+-static const unsigned char sbox[256] = { 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
+- 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
+- 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
+- 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
+- 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
+- 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
+- 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
+- 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 };
+-
+-static const unsigned char invSbox[256] = { 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb,
+- 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25,
+- 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84,
+- 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b,
+- 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e,
+- 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4,
+- 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef,
+- 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d };
+-
+-static const unsigned int rcon[11] = { 0x00000000, // unused
+- 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000, 0x1b000000, 0x36000000 };
+-
+-static inline unsigned int subWord(unsigned int x)
+-{
+- return (sbox[x >> 24] << 24) | (sbox[(x >> 16) & 0xff] << 16) | (sbox[(x >> 8) & 0xff] << 8) | sbox[x & 0xff];
+-}
++static const unsigned char sbox[256] = {
++ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
++ 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
++ 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
++ 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
++ 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
++ 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
++ 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
++ 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
++ 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
++ 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
++ 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
++ 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
++ 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
++ 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
++ 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
++ 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
++};
+
+-static inline unsigned int rotWord(unsigned int x)
+-{
+- return ((x << 8) & 0xffffffff) | (x >> 24);
+-}
++static const unsigned char invSbox[256] = {
++ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb,
++ 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb,
++ 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e,
++ 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25,
++ 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92,
++ 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84,
++ 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06,
++ 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b,
++ 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73,
++ 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e,
++ 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b,
++ 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4,
++ 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f,
++ 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef,
++ 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61,
++ 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
++};
+
+-static inline void subBytes(unsigned char *state)
+-{
+- int i;
++static const unsigned int rcon[11] = {
++ 0x00000000, // unused
++ 0x01000000,
++ 0x02000000,
++ 0x04000000,
++ 0x08000000,
++ 0x10000000,
++ 0x20000000,
++ 0x40000000,
++ 0x80000000,
++ 0x1b000000,
++ 0x36000000
++};
+
+- for (i = 0; i < 16; ++i) {
+- state[i] = sbox[state[i]];
+- }
++static inline unsigned int subWord(unsigned int x) {
++ return (sbox[x >> 24] << 24)
++ | (sbox[(x >> 16) & 0xff] << 16)
++ | (sbox[(x >> 8) & 0xff] << 8)
++ | sbox[x & 0xff];
+ }
+
+-static inline void invSubBytes(unsigned char *state)
+-{
+- int i;
++static inline unsigned int rotWord(unsigned int x) {
++ return ((x << 8) & 0xffffffff) | (x >> 24);
++}
+
+- for (i = 0; i < 16; ++i) {
+- state[i] = invSbox[state[i]];
+- }
++static inline void subBytes(unsigned char *state) {
++ int i;
++
++ for (i = 0; i < 16; ++i) {
++ state[i] = sbox[state[i]];
++ }
+ }
+
+-static inline void shiftRows(unsigned char *state)
+-{
+- unsigned char t;
++static inline void invSubBytes(unsigned char *state) {
++ int i;
+
+- t = state[4];
+- state[4] = state[5];
+- state[5] = state[6];
+- state[6] = state[7];
+- state[7] = t;
+-
+- t = state[8];
+- state[8] = state[10];
+- state[10] = t;
+- t = state[9];
+- state[9] = state[11];
+- state[11] = t;
+-
+- t = state[15];
+- state[15] = state[14];
+- state[14] = state[13];
+- state[13] = state[12];
+- state[12] = t;
++ for (i = 0; i < 16; ++i) {
++ state[i] = invSbox[state[i]];
++ }
+ }
+
+-static inline void invShiftRows(unsigned char *state)
+-{
+- unsigned char t;
++static inline void shiftRows(unsigned char *state) {
++ unsigned char t;
++
++ t = state[4];
++ state[4] = state[5];
++ state[5] = state[6];
++ state[6] = state[7];
++ state[7] = t;
++
++ t = state[8];
++ state[8] = state[10];
++ state[10] = t;
++ t = state[9];
++ state[9] = state[11];
++ state[11] = t;
++
++ t = state[15];
++ state[15] = state[14];
++ state[14] = state[13];
++ state[13] = state[12];
++ state[12] = t;
++}
+
+- t = state[7];
+- state[7] = state[6];
+- state[6] = state[5];
+- state[5] = state[4];
+- state[4] = t;
+-
+- t = state[8];
+- state[8] = state[10];
+- state[10] = t;
+- t = state[9];
+- state[9] = state[11];
+- state[11] = t;
+-
+- t = state[12];
+- state[12] = state[13];
+- state[13] = state[14];
+- state[14] = state[15];
+- state[15] = t;
++static inline void invShiftRows(unsigned char *state) {
++ unsigned char t;
++
++ t = state[7];
++ state[7] = state[6];
++ state[6] = state[5];
++ state[5] = state[4];
++ state[4] = t;
++
++ t = state[8];
++ state[8] = state[10];
++ state[10] = t;
++ t = state[9];
++ state[9] = state[11];
++ state[11] = t;
++
++ t = state[12];
++ state[12] = state[13];
++ state[13] = state[14];
++ state[14] = state[15];
++ state[15] = t;
+ }
+
+ // {02} \cdot s
+ struct Mul02Table
+ {
+- constexpr Mul02Table() : values()
+- {
+- for (int s = 0; s < 256; s++) {
+- values[s] = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
+- }
++ constexpr Mul02Table() : values()
++ {
++ for(int s = 0; s < 256; s++) {
++ values[s] = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
+ }
++ }
+
+- constexpr unsigned char operator()(uint8_t i) const { return values[i]; }
++ constexpr unsigned char operator()(uint8_t i) const { return values[i]; }
+
+- unsigned char values[256];
++ unsigned char values[256];
+ };
+
+ static constexpr Mul02Table mul02;
+@@ -739,17 +767,17 @@ static constexpr Mul02Table mul02;
+ // {03} \cdot s
+ struct Mul03Table
+ {
+- constexpr Mul03Table() : values()
+- {
+- for (int s = 0; s < 256; s++) {
+- const unsigned char s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
+- values[s] = s ^ s2;
+- }
++ constexpr Mul03Table() : values()
++ {
++ for(int s=0; s<256; s++) {
++ const unsigned char s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
++ values[s] = s ^ s2;
+ }
++ }
+
+- constexpr unsigned char operator()(uint8_t i) const { return values[i]; }
++ constexpr unsigned char operator()(uint8_t i) const { return values[i]; }
+
+- unsigned char values[256];
++ unsigned char values[256];
+ };
+
+ static constexpr Mul03Table mul03;
+@@ -757,19 +785,19 @@ static constexpr Mul03Table mul03;
+ // {09} \cdot s
+ struct Mul09Table
+ {
+- constexpr Mul09Table() : values()
+- {
+- for (int s = 0; s < 256; s++) {
+- const unsigned char s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
+- const unsigned char s4 = (s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1);
+- const unsigned char s8 = (s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1);
+- values[s] = s ^ s8;
+- }
++ constexpr Mul09Table() : values()
++ {
++ for(int s=0; s<256; s++) {
++ const unsigned char s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
++ const unsigned char s4 = (s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1);
++ const unsigned char s8 = (s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1);
++ values[s] = s ^ s8;
+ }
++ }
+
+- constexpr unsigned char operator()(uint8_t i) const { return values[i]; }
++ constexpr unsigned char operator()(uint8_t i) const { return values[i]; }
+
+- unsigned char values[256];
++ unsigned char values[256];
+ };
+
+ static constexpr Mul09Table mul09;
+@@ -777,19 +805,19 @@ static constexpr Mul09Table mul09;
+ // {0b} \cdot s
+ struct Mul0bTable
+ {
+- constexpr Mul0bTable() : values()
+- {
+- for (int s = 0; s < 256; s++) {
+- const unsigned char s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
+- const unsigned char s4 = (s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1);
+- const unsigned char s8 = (s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1);
+- values[s] = s ^ s2 ^ s8;
+- }
++ constexpr Mul0bTable() : values()
++ {
++ for(int s=0; s<256; s++) {
++ const unsigned char s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
++ const unsigned char s4 = (s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1);
++ const unsigned char s8 = (s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1);
++ values[s] = s ^ s2 ^ s8;
+ }
++ }
+
+- constexpr unsigned char operator()(uint8_t i) const { return values[i]; }
++ constexpr unsigned char operator()(uint8_t i) const { return values[i]; }
+
+- unsigned char values[256];
++ unsigned char values[256];
+ };
+
+ static constexpr Mul0bTable mul0b;
+@@ -797,19 +825,19 @@ static constexpr Mul0bTable mul0b;
+ // {0d} \cdot s
+ struct Mul0dTable
+ {
+- constexpr Mul0dTable() : values()
+- {
+- for (int s = 0; s < 256; s++) {
+- const unsigned char s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
+- const unsigned char s4 = (s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1);
+- const unsigned char s8 = (s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1);
+- values[s] = s ^ s4 ^ s8;
+- }
++ constexpr Mul0dTable() : values()
++ {
++ for(int s=0; s<256; s++) {
++ const unsigned char s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
++ const unsigned char s4 = (s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1);
++ const unsigned char s8 = (s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1);
++ values[s] = s ^ s4 ^ s8;
+ }
++ }
+
+- constexpr unsigned char operator()(uint8_t i) const { return values[i]; }
++ constexpr unsigned char operator()(uint8_t i) const { return values[i]; }
+
+- unsigned char values[256];
++ unsigned char values[256];
+ };
+
+ static constexpr Mul0dTable mul0d;
+@@ -817,329 +845,327 @@ static constexpr Mul0dTable mul0d;
+ // {0e} \cdot s
+ struct Mul0eTable
+ {
+- constexpr Mul0eTable() : values()
+- {
+- for (int s = 0; s < 256; s++) {
+- const unsigned char s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
+- const unsigned char s4 = (s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1);
+- const unsigned char s8 = (s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1);
+- values[s] = s2 ^ s4 ^ s8;
+- }
++ constexpr Mul0eTable() : values()
++ {
++ for(int s=0; s<256; s++) {
++ const unsigned char s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
++ const unsigned char s4 = (s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1);
++ const unsigned char s8 = (s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1);
++ values[s] = s2 ^ s4 ^ s8;
+ }
++ }
+
+- constexpr unsigned char operator()(uint8_t i) const { return values[i]; }
++ constexpr unsigned char operator()(uint8_t i) const { return values[i]; }
+
+- unsigned char values[256];
++ unsigned char values[256];
+ };
+
+ static constexpr Mul0eTable mul0e;
+
+-static inline void mixColumns(unsigned char *state)
+-{
+- int c;
+- unsigned char s0, s1, s2, s3;
+-
+- for (c = 0; c < 4; ++c) {
+- s0 = state[c];
+- s1 = state[4 + c];
+- s2 = state[8 + c];
+- s3 = state[12 + c];
+- state[c] = mul02(s0) ^ mul03(s1) ^ s2 ^ s3;
+- state[4 + c] = s0 ^ mul02(s1) ^ mul03(s2) ^ s3;
+- state[8 + c] = s0 ^ s1 ^ mul02(s2) ^ mul03(s3);
+- state[12 + c] = mul03(s0) ^ s1 ^ s2 ^ mul02(s3);
+- }
++static inline void mixColumns(unsigned char *state) {
++ int c;
++ unsigned char s0, s1, s2, s3;
++
++ for (c = 0; c < 4; ++c) {
++ s0 = state[c];
++ s1 = state[4+c];
++ s2 = state[8+c];
++ s3 = state[12+c];
++ state[c] = mul02(s0) ^ mul03(s1) ^ s2 ^ s3;
++ state[4+c] = s0 ^ mul02(s1) ^ mul03(s2) ^ s3;
++ state[8+c] = s0 ^ s1 ^ mul02(s2) ^ mul03(s3);
++ state[12+c] = mul03(s0) ^ s1 ^ s2 ^ mul02(s3);
++ }
+ }
+
+-static inline void invMixColumns(unsigned char *state)
+-{
+- int c;
+- unsigned char s0, s1, s2, s3;
+-
+- for (c = 0; c < 4; ++c) {
+- s0 = state[c];
+- s1 = state[4 + c];
+- s2 = state[8 + c];
+- s3 = state[12 + c];
+- state[c] = mul0e(s0) ^ mul0b(s1) ^ mul0d(s2) ^ mul09(s3);
+- state[4 + c] = mul09(s0) ^ mul0e(s1) ^ mul0b(s2) ^ mul0d(s3);
+- state[8 + c] = mul0d(s0) ^ mul09(s1) ^ mul0e(s2) ^ mul0b(s3);
+- state[12 + c] = mul0b(s0) ^ mul0d(s1) ^ mul09(s2) ^ mul0e(s3);
+- }
++static inline void invMixColumns(unsigned char *state) {
++ int c;
++ unsigned char s0, s1, s2, s3;
++
++ for (c = 0; c < 4; ++c) {
++ s0 = state[c];
++ s1 = state[4+c];
++ s2 = state[8+c];
++ s3 = state[12+c];
++ state[c] = mul0e(s0) ^ mul0b(s1) ^ mul0d(s2) ^ mul09(s3);
++ state[4+c] = mul09(s0) ^ mul0e(s1) ^ mul0b(s2) ^ mul0d(s3);
++ state[8+c] = mul0d(s0) ^ mul09(s1) ^ mul0e(s2) ^ mul0b(s3);
++ state[12+c] = mul0b(s0) ^ mul0d(s1) ^ mul09(s2) ^ mul0e(s3);
++ }
+ }
+
+-static inline void invMixColumnsW(unsigned int *w)
+-{
+- int c;
+- unsigned char s0, s1, s2, s3;
+-
+- for (c = 0; c < 4; ++c) {
+- s0 = w[c] >> 24;
+- s1 = w[c] >> 16;
+- s2 = w[c] >> 8;
+- s3 = w[c];
+- w[c] = ((mul0e(s0) ^ mul0b(s1) ^ mul0d(s2) ^ mul09(s3)) << 24) | ((mul09(s0) ^ mul0e(s1) ^ mul0b(s2) ^ mul0d(s3)) << 16) | ((mul0d(s0) ^ mul09(s1) ^ mul0e(s2) ^ mul0b(s3)) << 8) | (mul0b(s0) ^ mul0d(s1) ^ mul09(s2) ^ mul0e(s3));
+- }
++static inline void invMixColumnsW(unsigned int *w) {
++ int c;
++ unsigned char s0, s1, s2, s3;
++
++ for (c = 0; c < 4; ++c) {
++ s0 = w[c] >> 24;
++ s1 = w[c] >> 16;
++ s2 = w[c] >> 8;
++ s3 = w[c];
++ w[c] = ((mul0e(s0) ^ mul0b(s1) ^ mul0d(s2) ^ mul09(s3)) << 24)
++ | ((mul09(s0) ^ mul0e(s1) ^ mul0b(s2) ^ mul0d(s3)) << 16)
++ | ((mul0d(s0) ^ mul09(s1) ^ mul0e(s2) ^ mul0b(s3)) << 8)
++ | (mul0b(s0) ^ mul0d(s1) ^ mul09(s2) ^ mul0e(s3));
++ }
+ }
+
+-static inline void addRoundKey(unsigned char *state, const unsigned int *w)
+-{
+- int c;
++static inline void addRoundKey(unsigned char *state, const unsigned int *w) {
++ int c;
+
+- for (c = 0; c < 4; ++c) {
+- state[c] ^= w[c] >> 24;
+- state[4 + c] ^= w[c] >> 16;
+- state[8 + c] ^= w[c] >> 8;
+- state[12 + c] ^= w[c];
+- }
++ for (c = 0; c < 4; ++c) {
++ state[c] ^= w[c] >> 24;
++ state[4+c] ^= w[c] >> 16;
++ state[8+c] ^= w[c] >> 8;
++ state[12+c] ^= w[c];
++ }
+ }
+
+-static void aesKeyExpansion(DecryptAESState *s, const unsigned char *objKey, int /*objKeyLen*/, bool decrypt)
+-{
+- unsigned int temp;
+- int i, round;
++static void aesKeyExpansion(DecryptAESState *s,
++ const unsigned char *objKey, int /*objKeyLen*/, bool decrypt) {
++ unsigned int temp;
++ int i, round;
+
+- //~ this assumes objKeyLen == 16
++ //~ this assumes objKeyLen == 16
+
+- for (i = 0; i < 4; ++i) {
+- s->w[i] = (objKey[4 * i] << 24) + (objKey[4 * i + 1] << 16) + (objKey[4 * i + 2] << 8) + objKey[4 * i + 3];
+- }
+- for (i = 4; i < 44; ++i) {
+- temp = s->w[i - 1];
+- if (!(i & 3)) {
+- temp = subWord(rotWord(temp)) ^ rcon[i / 4];
+- }
+- s->w[i] = s->w[i - 4] ^ temp;
++ for (i = 0; i < 4; ++i) {
++ s->w[i] = (objKey[4*i] << 24) + (objKey[4*i+1] << 16) +
++ (objKey[4*i+2] << 8) + objKey[4*i+3];
++ }
++ for (i = 4; i < 44; ++i) {
++ temp = s->w[i-1];
++ if (!(i & 3)) {
++ temp = subWord(rotWord(temp)) ^ rcon[i/4];
+ }
++ s->w[i] = s->w[i-4] ^ temp;
++ }
+
+- /* In case of decryption, adjust the key schedule for the equivalent inverse cipher */
+- if (decrypt) {
+- for (round = 1; round <= 9; ++round) {
+- invMixColumnsW(&s->w[round * 4]);
+- }
++ /* In case of decryption, adjust the key schedule for the equivalent inverse cipher */
++ if (decrypt) {
++ for (round = 1; round <= 9; ++round) {
++ invMixColumnsW(&s->w[round * 4]);
+ }
++ }
+ }
+
+-static void aesEncryptBlock(DecryptAESState *s, const unsigned char *in)
+-{
+- int c, round;
+-
+- // initial state (input is xor'd with previous output because of CBC)
+- for (c = 0; c < 4; ++c) {
+- s->state[c] = in[4 * c] ^ s->buf[4 * c];
+- s->state[4 + c] = in[4 * c + 1] ^ s->buf[4 * c + 1];
+- s->state[8 + c] = in[4 * c + 2] ^ s->buf[4 * c + 2];
+- s->state[12 + c] = in[4 * c + 3] ^ s->buf[4 * c + 3];
+- }
++static void aesEncryptBlock(DecryptAESState *s, const unsigned char *in) {
++ int c, round;
+
+- // round 0
+- addRoundKey(s->state, &s->w[0]);
++ // initial state (input is xor'd with previous output because of CBC)
++ for (c = 0; c < 4; ++c) {
++ s->state[c] = in[4*c] ^ s->buf[4*c];
++ s->state[4+c] = in[4*c+1] ^ s->buf[4*c+1];
++ s->state[8+c] = in[4*c+2] ^ s->buf[4*c+2];
++ s->state[12+c] = in[4*c+3] ^ s->buf[4*c+3];
++ }
+
+- // rounds 1-9
+- for (round = 1; round <= 9; ++round) {
+- subBytes(s->state);
+- shiftRows(s->state);
+- mixColumns(s->state);
+- addRoundKey(s->state, &s->w[round * 4]);
+- }
++ // round 0
++ addRoundKey(s->state, &s->w[0]);
+
+- // round 10
++ // rounds 1-9
++ for (round = 1; round <= 9; ++round) {
+ subBytes(s->state);
+ shiftRows(s->state);
+- addRoundKey(s->state, &s->w[10 * 4]);
+-
+- for (c = 0; c < 4; ++c) {
+- s->buf[4 * c] = s->state[c];
+- s->buf[4 * c + 1] = s->state[4 + c];
+- s->buf[4 * c + 2] = s->state[8 + c];
+- s->buf[4 * c + 3] = s->state[12 + c];
+- }
+-
+- s->bufIdx = 0;
++ mixColumns(s->state);
++ addRoundKey(s->state, &s->w[round * 4]);
++ }
++
++ // round 10
++ subBytes(s->state);
++ shiftRows(s->state);
++ addRoundKey(s->state, &s->w[10 * 4]);
++
++ for (c = 0; c < 4; ++c) {
++ s->buf[4*c] = s->state[c];
++ s->buf[4*c+1] = s->state[4+c];
++ s->buf[4*c+2] = s->state[8+c];
++ s->buf[4*c+3] = s->state[12+c];
++ }
++
++ s->bufIdx = 0;
+ }
+
+-static void aesDecryptBlock(DecryptAESState *s, const unsigned char *in, bool last)
+-{
+- int c, round, n, i;
+-
+- // initial state
+- for (c = 0; c < 4; ++c) {
+- s->state[c] = in[4 * c];
+- s->state[4 + c] = in[4 * c + 1];
+- s->state[8 + c] = in[4 * c + 2];
+- s->state[12 + c] = in[4 * c + 3];
+- }
++static void aesDecryptBlock(DecryptAESState *s, const unsigned char *in, bool last) {
++ int c, round, n, i;
+
+- // round 0
+- addRoundKey(s->state, &s->w[10 * 4]);
++ // initial state
++ for (c = 0; c < 4; ++c) {
++ s->state[c] = in[4*c];
++ s->state[4+c] = in[4*c+1];
++ s->state[8+c] = in[4*c+2];
++ s->state[12+c] = in[4*c+3];
++ }
+
+- // rounds 1-9
+- for (round = 9; round >= 1; --round) {
+- invSubBytes(s->state);
+- invShiftRows(s->state);
+- invMixColumns(s->state);
+- addRoundKey(s->state, &s->w[round * 4]);
+- }
++ // round 0
++ addRoundKey(s->state, &s->w[10 * 4]);
+
+- // round 10
++ // rounds 1-9
++ for (round = 9; round >= 1; --round) {
+ invSubBytes(s->state);
+ invShiftRows(s->state);
+- addRoundKey(s->state, &s->w[0]);
+-
+- // CBC
+- for (c = 0; c < 4; ++c) {
+- s->buf[4 * c] = s->state[c] ^ s->cbc[4 * c];
+- s->buf[4 * c + 1] = s->state[4 + c] ^ s->cbc[4 * c + 1];
+- s->buf[4 * c + 2] = s->state[8 + c] ^ s->cbc[4 * c + 2];
+- s->buf[4 * c + 3] = s->state[12 + c] ^ s->cbc[4 * c + 3];
+- }
+-
+- // save the input block for the next CBC
+- for (i = 0; i < 16; ++i) {
+- s->cbc[i] = in[i];
+- }
+-
+- // remove padding
+- s->bufIdx = 0;
+- if (last) {
+- n = s->buf[15];
+- if (n < 1 || n > 16) { // this should never happen
+- n = 16;
+- }
+- for (i = 15; i >= n; --i) {
+- s->buf[i] = s->buf[i - n];
+- }
+- s->bufIdx = n;
+- }
++ invMixColumns(s->state);
++ addRoundKey(s->state, &s->w[round * 4]);
++ }
++
++ // round 10
++ invSubBytes(s->state);
++ invShiftRows(s->state);
++ addRoundKey(s->state, &s->w[0]);
++
++ // CBC
++ for (c = 0; c < 4; ++c) {
++ s->buf[4*c] = s->state[c] ^ s->cbc[4*c];
++ s->buf[4*c+1] = s->state[4+c] ^ s->cbc[4*c+1];
++ s->buf[4*c+2] = s->state[8+c] ^ s->cbc[4*c+2];
++ s->buf[4*c+3] = s->state[12+c] ^ s->cbc[4*c+3];
++ }
++
++ // save the input block for the next CBC
++ for (i = 0; i < 16; ++i) {
++ s->cbc[i] = in[i];
++ }
++
++ // remove padding
++ s->bufIdx = 0;
++ if (last) {
++ n = s->buf[15];
++ if (n < 1 || n > 16) { // this should never happen
++ n = 16;
++ }
++ for (i = 15; i >= n; --i) {
++ s->buf[i] = s->buf[i-n];
++ }
++ s->bufIdx = n;
++ }
+ }
+
+ //------------------------------------------------------------------------
+ // AES-256 decryption
+ //------------------------------------------------------------------------
+
+-static void aes256KeyExpansion(DecryptAES256State *s, const unsigned char *objKey, int objKeyLen, bool decrypt)
+-{
+- unsigned int temp;
+- int i, round;
+-
+- //~ this assumes objKeyLen == 32
+-
+- for (i = 0; i < 8; ++i) {
+- s->w[i] = (objKey[4 * i] << 24) + (objKey[4 * i + 1] << 16) + (objKey[4 * i + 2] << 8) + objKey[4 * i + 3];
+- }
+- for (i = 8; i < 60; ++i) {
+- temp = s->w[i - 1];
+- if ((i & 7) == 0) {
+- temp = subWord(rotWord(temp)) ^ rcon[i / 8];
+- } else if ((i & 7) == 4) {
+- temp = subWord(temp);
+- }
+- s->w[i] = s->w[i - 8] ^ temp;
+- }
+-
+- /* In case of decryption, adjust the key schedule for the equivalent inverse cipher */
+- if (decrypt) {
+- for (round = 1; round <= 13; ++round) {
+- invMixColumnsW(&s->w[round * 4]);
+- }
++static void aes256KeyExpansion(DecryptAES256State *s,
++ const unsigned char *objKey, int objKeyLen, bool decrypt) {
++ unsigned int temp;
++ int i, round;
++
++ //~ this assumes objKeyLen == 32
++
++ for (i = 0; i < 8; ++i) {
++ s->w[i] = (objKey[4*i] << 24) + (objKey[4*i+1] << 16) +
++ (objKey[4*i+2] << 8) + objKey[4*i+3];
++ }
++ for (i = 8; i < 60; ++i) {
++ temp = s->w[i-1];
++ if ((i & 7) == 0) {
++ temp = subWord(rotWord(temp)) ^ rcon[i/8];
++ } else if ((i & 7) == 4) {
++ temp = subWord(temp);
++ }
++ s->w[i] = s->w[i-8] ^ temp;
++ }
++
++ /* In case of decryption, adjust the key schedule for the equivalent inverse cipher */
++ if (decrypt) {
++ for (round = 1; round <= 13; ++round) {
++ invMixColumnsW(&s->w[round * 4]);
+ }
++ }
+ }
+
+-static void aes256EncryptBlock(DecryptAES256State *s, const unsigned char *in)
+-{
+- int c, round;
+-
+- // initial state (input is xor'd with previous output because of CBC)
+- for (c = 0; c < 4; ++c) {
+- s->state[c] = in[4 * c] ^ s->buf[4 * c];
+- s->state[4 + c] = in[4 * c + 1] ^ s->buf[4 * c + 1];
+- s->state[8 + c] = in[4 * c + 2] ^ s->buf[4 * c + 2];
+- s->state[12 + c] = in[4 * c + 3] ^ s->buf[4 * c + 3];
+- }
++static void aes256EncryptBlock(DecryptAES256State *s, const unsigned char *in) {
++ int c, round;
+
+- // round 0
+- addRoundKey(s->state, &s->w[0]);
++ // initial state (input is xor'd with previous output because of CBC)
++ for (c = 0; c < 4; ++c) {
++ s->state[c] = in[4*c] ^ s->buf[4*c];
++ s->state[4+c] = in[4*c+1] ^ s->buf[4*c+1];
++ s->state[8+c] = in[4*c+2] ^ s->buf[4*c+2];
++ s->state[12+c] = in[4*c+3] ^ s->buf[4*c+3];
++ }
+
+- // rounds 1-13
+- for (round = 1; round <= 13; ++round) {
+- subBytes(s->state);
+- shiftRows(s->state);
+- mixColumns(s->state);
+- addRoundKey(s->state, &s->w[round * 4]);
+- }
++ // round 0
++ addRoundKey(s->state, &s->w[0]);
+
+- // round 14
++ // rounds 1-13
++ for (round = 1; round <= 13; ++round) {
+ subBytes(s->state);
+ shiftRows(s->state);
+- addRoundKey(s->state, &s->w[14 * 4]);
+-
+- for (c = 0; c < 4; ++c) {
+- s->buf[4 * c] = s->state[c];
+- s->buf[4 * c + 1] = s->state[4 + c];
+- s->buf[4 * c + 2] = s->state[8 + c];
+- s->buf[4 * c + 3] = s->state[12 + c];
+- }
+-
+- s->bufIdx = 0;
++ mixColumns(s->state);
++ addRoundKey(s->state, &s->w[round * 4]);
++ }
++
++ // round 14
++ subBytes(s->state);
++ shiftRows(s->state);
++ addRoundKey(s->state, &s->w[14 * 4]);
++
++ for (c = 0; c < 4; ++c) {
++ s->buf[4*c] = s->state[c];
++ s->buf[4*c+1] = s->state[4+c];
++ s->buf[4*c+2] = s->state[8+c];
++ s->buf[4*c+3] = s->state[12+c];
++ }
++
++ s->bufIdx = 0;
+ }
+
+-static void aes256DecryptBlock(DecryptAES256State *s, const unsigned char *in, bool last)
+-{
+- int c, round, n, i;
+-
+- // initial state
+- for (c = 0; c < 4; ++c) {
+- s->state[c] = in[4 * c];
+- s->state[4 + c] = in[4 * c + 1];
+- s->state[8 + c] = in[4 * c + 2];
+- s->state[12 + c] = in[4 * c + 3];
+- }
++static void aes256DecryptBlock(DecryptAES256State *s, const unsigned char *in, bool last) {
++ int c, round, n, i;
+
+- // round 0
+- addRoundKey(s->state, &s->w[14 * 4]);
++ // initial state
++ for (c = 0; c < 4; ++c) {
++ s->state[c] = in[4*c];
++ s->state[4+c] = in[4*c+1];
++ s->state[8+c] = in[4*c+2];
++ s->state[12+c] = in[4*c+3];
++ }
+
+- // rounds 13-1
+- for (round = 13; round >= 1; --round) {
+- invSubBytes(s->state);
+- invShiftRows(s->state);
+- invMixColumns(s->state);
+- addRoundKey(s->state, &s->w[round * 4]);
+- }
++ // round 0
++ addRoundKey(s->state, &s->w[14 * 4]);
+
+- // round 14
++ // rounds 13-1
++ for (round = 13; round >= 1; --round) {
+ invSubBytes(s->state);
+ invShiftRows(s->state);
+- addRoundKey(s->state, &s->w[0]);
+-
+- // CBC
+- for (c = 0; c < 4; ++c) {
+- s->buf[4 * c] = s->state[c] ^ s->cbc[4 * c];
+- s->buf[4 * c + 1] = s->state[4 + c] ^ s->cbc[4 * c + 1];
+- s->buf[4 * c + 2] = s->state[8 + c] ^ s->cbc[4 * c + 2];
+- s->buf[4 * c + 3] = s->state[12 + c] ^ s->cbc[4 * c + 3];
+- }
+-
+- // save the input block for the next CBC
+- for (i = 0; i < 16; ++i) {
+- s->cbc[i] = in[i];
+- }
+-
+- // remove padding
+- s->bufIdx = 0;
+- if (last) {
+- n = s->buf[15];
+- if (n < 1 || n > 16) { // this should never happen
+- n = 16;
+- }
+- for (i = 15; i >= n; --i) {
+- s->buf[i] = s->buf[i - n];
+- }
+- s->bufIdx = n;
+- if (n > 16) {
+- error(errSyntaxError, -1, "Reducing bufIdx from {0:d} to 16 to not crash", n);
+- s->bufIdx = 16;
+- }
++ invMixColumns(s->state);
++ addRoundKey(s->state, &s->w[round * 4]);
++ }
++
++ // round 14
++ invSubBytes(s->state);
++ invShiftRows(s->state);
++ addRoundKey(s->state, &s->w[0]);
++
++ // CBC
++ for (c = 0; c < 4; ++c) {
++ s->buf[4*c] = s->state[c] ^ s->cbc[4*c];
++ s->buf[4*c+1] = s->state[4+c] ^ s->cbc[4*c+1];
++ s->buf[4*c+2] = s->state[8+c] ^ s->cbc[4*c+2];
++ s->buf[4*c+3] = s->state[12+c] ^ s->cbc[4*c+3];
++ }
++
++ // save the input block for the next CBC
++ for (i = 0; i < 16; ++i) {
++ s->cbc[i] = in[i];
++ }
++
++ // remove padding
++ s->bufIdx = 0;
++ if (last) {
++ n = s->buf[15];
++ if (n < 1 || n > 16) { // this should never happen
++ n = 16;
++ }
++ for (i = 15; i >= n; --i) {
++ s->buf[i] = s->buf[i-n];
++ }
++ s->bufIdx = n;
++ if (n > 16)
++ {
++ error(errSyntaxError, -1, "Reducing bufIdx from {0:d} to 16 to not crash", n);
++ s->bufIdx = 16;
+ }
++ }
+ }
+
+ //------------------------------------------------------------------------
+--
+2.29.2
+
diff --git a/external/poppler/StaticLibrary_poppler.mk b/external/poppler/StaticLibrary_poppler.mk
index 59a5a4ac94f0..63826316c977 100644
--- a/external/poppler/StaticLibrary_poppler.mk
+++ b/external/poppler/StaticLibrary_poppler.mk
@@ -51,6 +51,23 @@ endif
$(eval $(call gb_StaticLibrary_set_generated_cxx_suffix,poppler,cc))
+$(eval $(call gb_StaticLibrary_add_generated_cobjects,poppler,\
+ UnpackedTarball/poppler/poppler/CourierWidths.pregenerated \
+ UnpackedTarball/poppler/poppler/CourierBoldWidths.pregenerated \
+ UnpackedTarball/poppler/poppler/CourierBoldObliqueWidths.pregenerated \
+ UnpackedTarball/poppler/poppler/CourierObliqueWidths.pregenerated \
+ UnpackedTarball/poppler/poppler/HelveticaWidths.pregenerated \
+ UnpackedTarball/poppler/poppler/HelveticaBoldWidths.pregenerated \
+ UnpackedTarball/poppler/poppler/HelveticaBoldObliqueWidths.pregenerated \
+ UnpackedTarball/poppler/poppler/HelveticaObliqueWidths.pregenerated \
+ UnpackedTarball/poppler/poppler/SymbolWidths.pregenerated \
+ UnpackedTarball/poppler/poppler/TimesBoldWidths.pregenerated \
+ UnpackedTarball/poppler/poppler/TimesBoldItalicWidths.pregenerated \
+ UnpackedTarball/poppler/poppler/TimesItalicWidths.pregenerated \
+ UnpackedTarball/poppler/poppler/TimesRomanWidths.pregenerated \
+ UnpackedTarball/poppler/poppler/ZapfDingbatsWidths.pregenerated \
+))
+
$(eval $(call gb_StaticLibrary_add_generated_exception_objects,poppler,\
UnpackedTarball/poppler/goo/gfile \
UnpackedTarball/poppler/goo/GooTimer \
@@ -72,8 +89,7 @@ $(eval $(call gb_StaticLibrary_add_generated_exception_objects,poppler,\
UnpackedTarball/poppler/fofi/FoFiIdentifier \
UnpackedTarball/poppler/poppler/Annot \
UnpackedTarball/poppler/poppler/Array \
- UnpackedTarball/poppler/poppler/BuiltinFont \
- UnpackedTarball/poppler/poppler/BuiltinFontTables \
+ UnpackedTarball/poppler/poppler/BBoxOutputDev \
UnpackedTarball/poppler/poppler/CachedFile \
UnpackedTarball/poppler/poppler/Catalog \
UnpackedTarball/poppler/poppler/CertificateInfo \
@@ -95,6 +111,7 @@ $(eval $(call gb_StaticLibrary_add_generated_exception_objects,poppler,\
UnpackedTarball/poppler/poppler/Hints \
UnpackedTarball/poppler/poppler/JArithmeticDecoder \
UnpackedTarball/poppler/poppler/JBIG2Stream \
+ UnpackedTarball/poppler/poppler/JSInfo \
UnpackedTarball/poppler/poppler/Lexer \
UnpackedTarball/poppler/poppler/Link \
UnpackedTarball/poppler/poppler/Linearization \
@@ -109,6 +126,7 @@ $(eval $(call gb_StaticLibrary_add_generated_exception_objects,poppler,\
UnpackedTarball/poppler/poppler/PageTransition \
UnpackedTarball/poppler/poppler/Parser \
UnpackedTarball/poppler/poppler/PDFDoc \
+ UnpackedTarball/poppler/poppler/PDFDocBuilder \
UnpackedTarball/poppler/poppler/PDFDocEncoding \
UnpackedTarball/poppler/poppler/PDFDocFactory \
UnpackedTarball/poppler/poppler/ProfileData \
diff --git a/external/poppler/UnpackedTarball_poppler.mk b/external/poppler/UnpackedTarball_poppler.mk
index 76fd33236e5d..0f29d38e097c 100644
--- a/external/poppler/UnpackedTarball_poppler.mk
+++ b/external/poppler/UnpackedTarball_poppler.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,poppler,$(POPPLER_TARBALL),,poppler
$(eval $(call gb_UnpackedTarball_add_patches,poppler,\
external/poppler/poppler-config.patch.1 \
external/poppler/poppler-c++11.patch.1 \
+ external/poppler/0001-Partially-revert-814fbda28cc8a37fed3134c2db8da28f86f.patch.1 \
external/poppler/0001-Revert-Make-the-mul-tables-be-calculated-at-compile-.patch.1 \
))
diff --git a/external/poppler/poppler-c++11.patch.1 b/external/poppler/poppler-c++11.patch.1
index 5a4d1a24e2e2..9e607b381de0 100644
--- a/external/poppler/poppler-c++11.patch.1
+++ b/external/poppler/poppler-c++11.patch.1
@@ -12,18 +12,18 @@ remove usage of newfangled C++ that baseline toolchains don't support
namespace {
@@ -366,7 +366,7 @@
- }
+ }
#else
- // First try to atomically open the file with CLOEXEC
-- const std::string modeStr = mode + "e"s;
-+ const std::string modeStr = mode + std::string("e");
- FILE *file = fopen(path, modeStr.c_str());
- if (file != nullptr)
- return file;
+ // First try to atomically open the file with CLOEXEC
+- const std::string modeStr = mode + "e"s;
++ const std::string modeStr = mode + std::string("e");
+ FILE *file = fopen(path, modeStr.c_str());
+ if (file != nullptr)
+ return file;
--- poppler/goo/gmem.h.orig 2019-01-16 11:25:28.161920038 +0100
+++ poppler/goo/gmem.h 2019-01-16 11:25:53.756882295 +0100
@@ -177,4 +177,6 @@
- return std::strncpy(r, s, n);
+ return std::strncpy(r, s, n);
}
+#include <o3tl/make_unique.hxx>
diff --git a/external/poppler/poppler-config.patch.1 b/external/poppler/poppler-config.patch.1
index cb74cd66fb5e..b902402ea4e7 100644
--- a/external/poppler/poppler-config.patch.1
+++ b/external/poppler/poppler-config.patch.1
@@ -1,5 +1,7 @@
*three* poppler config headers
+note: to get the 3rd one, use -DENABLE_CPP=on
+
mkdir build && cd build && cmake .. -DENABLE_DCTDECODER=libjpeg -DHAVE_CAIRO=off -DENABLE_LIBOPENJPEG=none -DENABLE_CMS=none -DENABLE_LIBCURL=off -DENABLE_ZLIB=off -DENABLE_ZLIB_UNCOMPRESS=off -DENABLE_NSS3=off -DENABLE_LIBPNG=off -DENABLE_LIBTIFF=off -DENABLE_SPLASH=off -DENABLE_UTILS=off -DENABLE_CPP=off -DENABLE_GLIB=off -DENABLE_GOBJECT_INTROSPECTION=off -DENABLE_GTK_DOC=off -DENABLE_QT5=off
manually disabled these because cmake failed to do it:
@@ -14,7 +16,7 @@ new file mode 100644
index 0fbd336a..451213f8 100644
--- /dev/null
+++ b/config.h
-@@ -0,0 +1,248 @@
+@@ -0,0 +1,221 @@
+/* config.h. Generated from config.h.cmake by cmake. */
+
+/* Build against libcurl. */
@@ -120,21 +122,6 @@ index 0fbd336a..451213f8 100644
+#endif
+
+#if !defined(_WIN32)
-+/* Define to 1 if you have the `rand_r' function. */
-+#define HAVE_RAND_R 1
-+#endif
-+
-+#if defined(_WIN32)
-+/* Define to 1 if you have the `strcpy_s' function. */
-+#define HAVE_STRCPY_S 1
-+#endif
-+
-+#if defined(_WIN32)
-+/* Define to 1 if you have the `strcat_s' function. */
-+#define HAVE_STRCAT_S 1
-+#endif
-+
-+#if !defined(_WIN32)
+/* Defines if strtok_r is available on your system */
+#define HAVE_STRTOK_R 1
+#endif
@@ -147,9 +134,6 @@ index 0fbd336a..451213f8 100644
+#define HAVE_POPEN 1
+#endif
+
-+/* Use splash for rendering. */
-+/* #undef HAVE_SPLASH */
-+
+#if !defined(__APPLE__) && !defined(_WIN32)
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+ */
@@ -179,9 +163,6 @@ index 0fbd336a..451213f8 100644
+/* Define as const if the declaration of iconv() needs const. */
+#define ICONV_CONST
+
-+/* Enable multithreading support. */
-+#define MULTITHREADED 1
-+
+/* Generate OPI comments in PS output. */
+#define OPI_SUPPORT 1
+
@@ -195,7 +176,7 @@ index 0fbd336a..451213f8 100644
+#define PACKAGE_NAME "poppler"
+
+/* Define to the full name and version of this package. */
-+#define PACKAGE_STRING "poppler 0.82.0"
++#define PACKAGE_STRING "poppler 21.01.0"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "poppler"
@@ -204,7 +185,7 @@ index 0fbd336a..451213f8 100644
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
-+#define PACKAGE_VERSION "0.82.0"
++#define PACKAGE_VERSION "21.01.0"
+
+/* Poppler data dir */
+#define POPPLER_DATADIR "/usr/local/share/poppler"
@@ -212,23 +193,17 @@ index 0fbd336a..451213f8 100644
+/* Support for curl based doc builder is compiled in. */
+/* #undef POPPLER_HAS_CURL_SUPPORT */
+
-+/* Include support for CMYK rasterization */
-+/* #undef SPLASH_CMYK */
-+
+/* Enable word list support. */
+#define TEXTOUT_WORD_LIST 1
+
+/* Defines if use cms */
+/* #undef USE_CMS */
+
-+/* Use fixed point arithmetic in the Splash backend */
-+/* #undef USE_FIXEDPOINT */
-+
+/* Use single precision arithmetic in the Splash backend */
+/* #undef USE_FLOAT */
+
+/* Version number of package */
-+#define VERSION "0.82.0"
++#define VERSION "21.01.0"
+
+#if defined(__APPLE__)
+#elif defined (_WIN32)
@@ -268,7 +243,7 @@ new file mode 100644
index 0fbd336a..451213f8 100644
--- /dev/null
+++ b/poppler/poppler-config.h
-@@ -0,0 +1,173 @@
+@@ -0,0 +1,166 @@
+//================================================= -*- mode: c++ -*- ====
+//
+// poppler-config.h
@@ -288,6 +263,9 @@ index 0fbd336a..451213f8 100644
+// Copyright (C) 2014 Hib Eris <hib at hiberis.nl>
+// Copyright (C) 2016 Tor Lillqvist <tml at collabora.com>
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
++// Copyright (C) 2018 Adam Reichold <adam.reichold at t-online.de>
++// Copyright (C) 2018 Stefan Brüns <stefan.bruens at rwth-aachen.de>
++// Copyright (C) 2020 Albert Astals Cid <aacid at kde.org>
+//
+// To see a description of the changes please see the Changelog file that
+// came with your tarball or type make ChangeLog if you are building from git
@@ -304,17 +282,7 @@ index 0fbd336a..451213f8 100644
+
+/* Defines the poppler version. */
+#ifndef POPPLER_VERSION
-+#define POPPLER_VERSION "0.82.0"
-+#endif
-+
-+/* Enable multithreading support. */
-+#ifndef MULTITHREADED
-+#define MULTITHREADED 1
-+#endif
-+
-+/* Use fixedpoint. */
-+#ifndef USE_FIXEDPOINT
-+/* #undef USE_FIXEDPOINT */
++#define POPPLER_VERSION "21.01.0"
+#endif
+
+/* Use single precision arithmetic in the Splash backend */
@@ -401,17 +369,17 @@ index 0fbd336a..451213f8 100644
+/* #undef USE_BOOST_HEADERS */
+#endif
+
-+// Also, there are preprocessor symbols in the header files
-+// that are used but never defined when building poppler using configure
-+// or cmake: DISABLE_OUTLINE, DEBUG_MEM,
-+// ENABLE_PLUGINS, DEBUG_FORMS
++/* Is splash backend available */
++#ifndef HAVE_SPLASH
++/* #undef HAVE_SPLASH */
++#endif
+
+//------------------------------------------------------------------------
+// version
+//------------------------------------------------------------------------
+
+// copyright notice
-+#define popplerCopyright "Copyright 2005-2018 The Poppler Developers - http://poppler.freedesktop.org"
++#define popplerCopyright "Copyright 2005-2021 The Poppler Developers - http://poppler.freedesktop.org"
+#define xpdfCopyright "Copyright 1996-2011 Glyph & Cog, LLC"
+
+//------------------------------------------------------------------------
@@ -429,7 +397,7 @@ index 0fbd336a..451213f8 100644
+//------------------------------------------------------------------------
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
-+#include <stdio.h> // __MINGW_PRINTF_FORMAT is defined in the mingw stdio.h
++#include <cstdio> // __MINGW_PRINTF_FORMAT is defined in the mingw stdio.h
+#ifdef __MINGW_PRINTF_FORMAT
+#define GCC_PRINTF_FORMAT(fmt_index, va_index) \
+ __attribute__((__format__(__MINGW_PRINTF_FORMAT, fmt_index, va_index)))
@@ -471,9 +439,9 @@ index 0fbd336a..451213f8 100644
+
+#include "poppler-global.h"
+
-+#define POPPLER_VERSION "0.82.0"
-+#define POPPLER_VERSION_MAJOR 0
-+#define POPPLER_VERSION_MINOR 82
++#define POPPLER_VERSION "21.01.0"
++#define POPPLER_VERSION_MAJOR 21
++#define POPPLER_VERSION_MINOR 1
+#define POPPLER_VERSION_MICRO 0
+
+namespace poppler
commit 73cd8960a25c01fb30364d0847a72edb30c5f865
Author: Martin Whitaker <foss at martin-whitaker.me.uk>
AuthorDate: Fri May 8 21:47:25 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 10 16:51:53 2021 +0200
tdf#131353: Fix build with poppler 0.86.0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93789
Tested-by: René Engelhard <rene at debian.org>
Tested-by: Jenkins
Reviewed-by: Tomáš Chvátal <tchvatal at suse.com>
(cherry picked from commit b42ab78fb871924896b3cc38a7b2f1257151f711)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96639
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
(cherry picked from commit d40f36bf47814c324a1ec467c566255fb187444b)
Change-Id: I89b4635a6a3e3a5522172d6f4c3f14e6c14994b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108955
Tested-by: Thorsten Behrens <thorsten.behrens at allotropia.de>
Reviewed-by: Thorsten Behrens <thorsten.behrens at allotropia.de>
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index b132e33b8252..127d36bd8c22 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -581,7 +581,9 @@ void PDFOutDev::processLink(Link* link, Catalog*)
LinkAction* pAction = link->getAction();
if (pAction && pAction->getKind() == actionURI)
{
-#if POPPLER_CHECK_VERSION(0, 72, 0)
+#if POPPLER_CHECK_VERSION(0, 86, 0)
+ const char* pURI = static_cast<LinkURI*>(pAction)->getURI().c_str();
+#elif POPPLER_CHECK_VERSION(0, 72, 0)
const char* pURI = static_cast<LinkURI*>(pAction)->getURI()->c_str();
#else
const char* pURI = static_cast<LinkURI*>(pAction)->getURI()->getCString();
commit f589bec8da9f012f3acd22dba96f77d2e2e6195b
Author: Martin Milata <martin at martinmilata.cz>
AuthorDate: Wed Dec 4 02:37:40 2019 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 10 16:51:12 2021 +0200
Fix build with poppler-0.83
Change-Id: I7a3684932b8f9c403a3368b42fa4d8039c67f1a9
Reviewed-on: https://gerrit.libreoffice.org/84384
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86905
Reviewed-by: Tomáš Chvátal <tchvatal at suse.com>
Tested-by: Tomáš Chvátal <tchvatal at suse.com>
(cherry picked from commit 035830400393e075fca364a444e04c40516730b2)
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index c23a8cff90bd..b132e33b8252 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -510,11 +510,18 @@ void PDFOutDev::writeFontFile( GfxFont* gfxFont ) const
gfree(pBuf);
}
+#if POPPLER_CHECK_VERSION(0, 83, 0)
+void PDFOutDev::printPath( const GfxPath* pPath )
+#else
void PDFOutDev::printPath( GfxPath* pPath )
+#endif
{
int nSubPaths = pPath ? pPath->getNumSubpaths() : 0;
for( int i=0; i<nSubPaths; i++ )
{
+#if POPPLER_CHECK_VERSION(0, 83, 0)
+ const
+#endif
GfxSubpath* pSub = pPath->getSubpath( i );
const int nPoints = pSub->getNumPoints();
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
index e6e35eab88ef..6b97bf0a5fcb 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
@@ -149,7 +149,11 @@ namespace pdfi
int parseFont( long long nNewId, GfxFont* pFont, GfxState* state ) const;
void writeFontFile( GfxFont* gfxFont ) const;
+#if POPPLER_CHECK_VERSION(0, 83, 0)
+ static void printPath( const GfxPath* pPath );
+#else
static void printPath( GfxPath* pPath );
+#endif
public:
explicit PDFOutDev( PDFDoc* pDoc );
diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
index cd559cab08ee..eb57fe5a65ec 100644
--- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
@@ -68,7 +68,11 @@ int main(int argc, char **argv)
}
// read config file
+#if POPPLER_CHECK_VERSION(0, 83, 0)
+ globalParams = std::make_unique<GlobalParams>();
+#else
globalParams = new GlobalParams();
+#endif
globalParams->setErrQuiet(true);
#if defined(_MSC_VER)
globalParams->setupBaseFonts(nullptr);
commit 070d7b7d94442c3bb3dc38efcc62892ff167ad19
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Aug 7 18:57:00 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 10 16:33:59 2021 +0200
nss: upgrade to release 3.55.0
Fixes CVE-2020-6829, CVE-2020-12400 CVE-2020-12401 CVE-2020-12403.
(also CVE-2020-12402 CVE-2020-12399 in older releases since 3.47)
* external/nss/nss.nspr-parallel-win-debug_build.patch:
remove, merged upstream
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100345
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 495a5944a3d442cfe748a3bb0dcef76f6a961d30)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100420
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
(cherry picked from commit 227d30a3a17f2fffb1a166cdc3e2a796bb335214)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100590
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 94cecbfdf3cf01fe3d5658c7edf78696da2a249f)
Change-Id: I8b48e25ce68a2327cde1420abdaea8f9e51a7888
diff --git a/download.lst b/download.lst
index dea9f67a0727..1f6503badec7 100644
--- a/download.lst
+++ b/download.lst
@@ -164,8 +164,8 @@ export MYTHES_SHA256SUM := 1e81f395d8c851c3e4e75b568e20fa2fa549354e75ab397f9de4b
export MYTHES_TARBALL := a8c2c5b8f09e7ede322d5c602ff6a4b6-mythes-1.2.4.tar.gz
export NEON_SHA256SUM := 00c626c0dc18d094ab374dbd9a354915bfe4776433289386ed489c2ec0845cdd
export NEON_TARBALL := 231adebe5c2f78fded3e3df6e958878e-neon-0.30.1.tar.gz
-export NSS_SHA256SUM := 861a4510b7c21516f49a4cfa5b871aa796e4e1ef2dfe949091970e56f9d60cdf
-export NSS_TARBALL := nss-3.53-with-nspr-4.25.tar.gz
+export NSS_SHA256SUM := ec6032d78663c6ef90b4b83eb552dedf721d2bce208cec3bf527b8f637db7e45
+export NSS_TARBALL := nss-3.55-with-nspr-4.27.tar.gz
export ODFGEN_SHA256SUM := 2c7b21892f84a4c67546f84611eccdad6259875c971e98ddb027da66ea0ac9c2
export ODFGEN_VERSION_MICRO := 6
export ODFGEN_TARBALL := libodfgen-0.1.$(ODFGEN_VERSION_MICRO).tar.bz2
diff --git a/external/nss/UnpackedTarball_nss.mk b/external/nss/UnpackedTarball_nss.mk
index b77939f20f31..e77f92341d91 100644
--- a/external/nss/UnpackedTarball_nss.mk
+++ b/external/nss/UnpackedTarball_nss.mk
@@ -21,7 +21,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,nss,\
external/nss/clang-cl.patch.0 \
external/nss/nss.vs2015.patch \
external/nss/nss.vs2015.pdb.patch \
- external/nss/nss.nspr-parallel-win-debug_build.patch \
$(if $(filter iOS,$(OS)), \
external/nss/nss-ios.patch) \
$(if $(filter MSC-INTEL,$(COM)-$(CPUNAME)), \
diff --git a/external/nss/nss.nspr-parallel-win-debug_build.patch b/external/nss/nss.nspr-parallel-win-debug_build.patch
deleted file mode 100644
index 86b55e1ccf7f..000000000000
--- a/external/nss/nss.nspr-parallel-win-debug_build.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-Änderung: 4866:23940b78e965
-Nutzer: Jan-Marek Glogowski <glogow at fbihome.de>
-Datum: Fri May 01 22:50:55 2020 +0000
-Dateien: pr/tests/Makefile.in
-Beschreibung:
-Bug 290526 Write separate PDBs for test OBJs r=glandium
-
-Quite often when running a parallel NSS build, I get the following
-compiler error message, resulting in a build failure, despite
-compiling with the -FS flag:
-
-.../nss/nspr/pr/tests/zerolen.c: fatal error C1041:
-Programmdatenbank "...\nss\nspr\out\pr\tests\vc140.pdb" kann nicht
-ge<94>ffnet werden; verwenden Sie /FS, wenn mehrere CL.EXE in
-dieselbe .PDB-Datei schreiben.
-
-The failing source file is always one of the last test object
-files. But the actual problem is not the compiler accessing the
-PDB file, but the linker already linking the first test
-executables accessing the shared PDB; at least that's my guess.
-
-So instead of using a shared PDB for all test object files, this
-uses -Fd$(@:.$(OBJ_SUFFIX)=.pdb) to write a separate PDB for every
-test's object file. The linker works fine with the shared OBJ PDB.
-
-Differential Revision: https://phabricator.services.mozilla.com/D68693
-
-
-diff -r 219d131499d5 -r 23940b78e965 nss/nspr/pr/tests/Makefile.in
---- a/nss/nspr/pr/tests/Makefile.in Mon Feb 10 20:58:42 2020 +0000
-+++ b/nss/nspr/pr/tests/Makefile.in Fri May 01 22:50:55 2020 +0000
-@@ -211,6 +211,7 @@
- else
- EXTRA_LIBS += ws2_32.lib
- LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
-+ CFLAGS += -Fd$(@:.$(OBJ_SUFFIX)=.pdb)
- ifdef PROFILE
- LDOPTS += -PROFILE -MAP
- endif # profile
-
commit 954e1682af0e8ec6c62ce5e73b0e472c8b1d8369
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Wed Jun 26 18:09:19 2019 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 10 16:33:58 2021 +0200
NSS: enable parallel build
Since NSS 3.53, the Makefile based build should be fixed (upstream
bug 290526). The only missing patch is a minimal NSPR fix for the
"NSPR, configure + make, parallel, Windows, MS VS, debug" build.
That patch isn't incuded in the NSPR 4.25 release (but it's already
in the mercurial repo for NSPR 4.26).
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95218
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
(cherry picked from commit b56e8d6def26a0430853835e997f1be841840a61)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100419
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit c1bce55faebd9ad8751d7b6b9a7f77dff7b3d507)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100589
(cherry picked from commit 3e4dbb1708d4b3b7619602b63602b884a7bb2caa)
Change-Id: I8eaa3792a12bdff734e56ac3f552991478957e23
diff --git a/download.lst b/download.lst
index f46a38121016..dea9f67a0727 100644
--- a/download.lst
+++ b/download.lst
@@ -164,8 +164,8 @@ export MYTHES_SHA256SUM := 1e81f395d8c851c3e4e75b568e20fa2fa549354e75ab397f9de4b
export MYTHES_TARBALL := a8c2c5b8f09e7ede322d5c602ff6a4b6-mythes-1.2.4.tar.gz
export NEON_SHA256SUM := 00c626c0dc18d094ab374dbd9a354915bfe4776433289386ed489c2ec0845cdd
export NEON_TARBALL := 231adebe5c2f78fded3e3df6e958878e-neon-0.30.1.tar.gz
-export NSS_SHA256SUM := 07d4276168f59bb3038c7826dabb5fbfbab8336ddf65e4e6e43bce89ada78c64
-export NSS_TARBALL := nss-3.47.1-with-nspr-4.23.tar.gz
+export NSS_SHA256SUM := 861a4510b7c21516f49a4cfa5b871aa796e4e1ef2dfe949091970e56f9d60cdf
+export NSS_TARBALL := nss-3.53-with-nspr-4.25.tar.gz
export ODFGEN_SHA256SUM := 2c7b21892f84a4c67546f84611eccdad6259875c971e98ddb027da66ea0ac9c2
export ODFGEN_VERSION_MICRO := 6
export ODFGEN_TARBALL := libodfgen-0.1.$(ODFGEN_VERSION_MICRO).tar.bz2
diff --git a/external/nss/ExternalProject_nss.mk b/external/nss/ExternalProject_nss.mk
index f555975ee7fa..01b6b4e07794 100644
--- a/external/nss/ExternalProject_nss.mk
+++ b/external/nss/ExternalProject_nss.mk
@@ -29,11 +29,11 @@ ifeq ($(OS),WNT)
$(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject_get_state_target,nss,configure) $(call gb_ExternalExecutable_get_dependencies,python)
$(call gb_ExternalProject_run,build,\
$(if $(MSVC_USE_DEBUG_RUNTIME),USE_DEBUG_RTL=1,BUILD_OPT=1) \
- MOZ_MSVCVERSION=9 OS_TARGET=WIN95 \
+ OS_TARGET=WIN95 \
$(if $(filter X86_64,$(CPUNAME)),USE_64=1) \
LIB="$(ILIB)" \
XCFLAGS="-arch:SSE $(SOLARINC)" \
- $(MAKE) -j1 nss_build_all RC="rc.exe $(SOLARINC)" \
+ $(MAKE) nss_build_all RC="rc.exe $(SOLARINC)" \
NSINSTALL='$(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/external/nss/nsinstall.py' \
,nss)
@@ -53,7 +53,7 @@ $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject
$(if $(filter IOS-ARM,$(OS)-$(CPUNAME)),CPU_ARCH=arm) \
NSINSTALL="$(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/external/nss/nsinstall.py") \
NSDISTMODE=copy \
- $(MAKE) -j1 AR="$(AR)" \
+ $(MAKE) AR="$(AR)" \
RANLIB="$(RANLIB)" \
NMEDIT="$(NM)edit" \
CCC="$(CXX)" \
diff --git a/external/nss/UnpackedTarball_nss.mk b/external/nss/UnpackedTarball_nss.mk
index 463451ecd924..b77939f20f31 100644
--- a/external/nss/UnpackedTarball_nss.mk
+++ b/external/nss/UnpackedTarball_nss.mk
@@ -12,32 +12,32 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,nss))
$(eval $(call gb_UnpackedTarball_set_tarball,nss,$(NSS_TARBALL)))
$(eval $(call gb_UnpackedTarball_add_patches,nss,\
- external/nss/nss.patch \
- external/nss/nss.aix.patch \
- external/nss/nss-3.13.5-zlib-werror.patch \
- external/nss/nss_macosx.patch \
- external/nss/nss-win32-make.patch.1 \
- $(if $(filter WNT,$(OS)),external/nss/nss.windows.patch \
- external/nss/nss.nowerror.patch \
- external/nss/nss.vs2015.patch) \
+ external/nss/nss.patch \
+ external/nss/nss.aix.patch \
+ external/nss/nss-3.13.5-zlib-werror.patch \
+ external/nss/nss_macosx.patch \
+ external/nss/nss-win32-make.patch.1 \
external/nss/ubsan.patch.0 \
external/nss/clang-cl.patch.0 \
- $(if $(filter IOS,$(OS)), \
+ external/nss/nss.vs2015.patch \
+ external/nss/nss.vs2015.pdb.patch \
+ external/nss/nss.nspr-parallel-win-debug_build.patch \
+ $(if $(filter iOS,$(OS)), \
external/nss/nss-ios.patch) \
- $(if $(filter MSC-INTEL,$(COM)-$(CPUNAME)), \
- external/nss/nss.cygwin64.in32bit.patch) \
- $(if $(filter WNT,$(OS)), \
- external/nss/nss.vs2015.pdb.patch) \
+ $(if $(filter MSC-INTEL,$(COM)-$(CPUNAME)), \
+ external/nss/nss.cygwin64.in32bit.patch) \
$(if $(findstring 120_70,$(VCVER)_$(WINDOWS_SDK_VERSION)), \
external/nss/nss-winXP-sdk.patch.1) \
- $(if $(filter WNT,$(OS)), \
- external/nss/nss.utf8bom.patch.1) \
+ $(if $(filter WNT,$(OS)), \
+ external/nss/nss.windows.patch \
+ external/nss/nss.nowerror.patch \
+ external/nss/nss.utf8bom.patch.1) \
))
ifeq ($(COM_IS_CLANG),TRUE)
ifneq ($(filter -fsanitize=%,$(CC)),)
$(eval $(call gb_UnpackedTarball_add_patches,nss,\
- external/nss/asan.patch.1 \
+ external/nss/asan.patch.1 \
))
endif
endif
diff --git a/external/nss/nsinstall.py b/external/nss/nsinstall.py
index 31b3de3450c5..80e9c1679373 100644
--- a/external/nss/nsinstall.py
+++ b/external/nss/nsinstall.py
@@ -155,7 +155,12 @@ def nsinstall(argv):
target = args.pop()
# ensure target directory
if not os.path.isdir(target):
- os.makedirs(target)
+ try:
+ os.makedirs(target)
+ except FileExistsError:
+ if not os.path.isdir(target):
+ sys.stderr.write('nsinstall: ' + target + ' is not a directoy!\n')
+ return 1
copy_all_entries(args, target)
return 0
diff --git a/external/nss/nss-3.13.5-zlib-werror.patch b/external/nss/nss-3.13.5-zlib-werror.patch
index 6cda50023f1b..0cdbf7808f81 100644
--- a/external/nss/nss-3.13.5-zlib-werror.patch
+++ b/external/nss/nss-3.13.5-zlib-werror.patch
@@ -1,9 +1,10 @@
--- a/a/nss/lib/zlib/gzguts.h 2010-08-22 03:07:03.000000000 +0200
+++ b/b/nss/lib/zlib/gzguts.h 2012-07-17 08:52:14.821552788 +0200
-@@ -26,6 +26,9 @@
- # include <limits.h>
+@@ -26,6 +26,10 @@
+ # define write _write
+ # define close _close
#endif
- #include <fcntl.h>
++
+#ifndef _WIN32
+#include <unistd.h>
+#endif
diff --git a/external/nss/nss-win32-make.patch.1 b/external/nss/nss-win32-make.patch.1
index bc5a759275e2..7ba3df451ee6 100644
--- a/external/nss/nss-win32-make.patch.1
+++ b/external/nss/nss-win32-make.patch.1
@@ -1,7 +1,7 @@
--- nss/nss/coreconf/rules.mk.orig2 2014-06-03 15:30:01.667200000 +0200
+++ nss/nss/coreconf/rules.mk 2014-06-03 15:30:14.537200000 +0200
@@ -259,7 +259,7 @@
- @$(MAKE_OBJDIR)
+ $(LIBRARY): $(OBJS) | $$(@D)/d
rm -f $@
ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
- $(AR) $(subst /,\\,$(OBJS))
diff --git a/external/nss/nss.nspr-parallel-win-debug_build.patch b/external/nss/nss.nspr-parallel-win-debug_build.patch
new file mode 100644
index 000000000000..86b55e1ccf7f
--- /dev/null
+++ b/external/nss/nss.nspr-parallel-win-debug_build.patch
@@ -0,0 +1,40 @@
+Änderung: 4866:23940b78e965
+Nutzer: Jan-Marek Glogowski <glogow at fbihome.de>
+Datum: Fri May 01 22:50:55 2020 +0000
+Dateien: pr/tests/Makefile.in
+Beschreibung:
+Bug 290526 Write separate PDBs for test OBJs r=glandium
+
+Quite often when running a parallel NSS build, I get the following
+compiler error message, resulting in a build failure, despite
+compiling with the -FS flag:
+
+.../nss/nspr/pr/tests/zerolen.c: fatal error C1041:
+Programmdatenbank "...\nss\nspr\out\pr\tests\vc140.pdb" kann nicht
+ge<94>ffnet werden; verwenden Sie /FS, wenn mehrere CL.EXE in
+dieselbe .PDB-Datei schreiben.
+
+The failing source file is always one of the last test object
+files. But the actual problem is not the compiler accessing the
+PDB file, but the linker already linking the first test
+executables accessing the shared PDB; at least that's my guess.
+
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list