From 98a501948e39f5ea2cd0793610220d2f1904f986 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Sat, 22 Sep 2018 08:15:42 +0000 Subject: revert poppler (0.68.0) git-svn-id: svn://tug.org/texlive/trunk@48731 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/libs/README | 9 +- Build/source/libs/poppler/ChangeLog | 5 - Build/source/libs/poppler/Makefile.am | 2 + Build/source/libs/poppler/Makefile.in | 17 + Build/source/libs/poppler/TLpatches/ChangeLog | 4 - Build/source/libs/poppler/TLpatches/TL-Changes | 5 +- Build/source/libs/poppler/TLpatches/patch-03-time | 12 +- Build/source/libs/poppler/configure | 22 +- .../source/libs/poppler/poppler-src/CMakeLists.txt | 10 +- Build/source/libs/poppler/poppler-src/ChangeLog | 1078 -------------------- Build/source/libs/poppler/poppler-src/NEWS | 31 - .../libs/poppler/poppler-src/fofi/FoFiType1C.cc | 10 +- .../libs/poppler/poppler-src/goo/GooCheckedOps.h | 49 - .../libs/poppler/poppler-src/goo/JpegWriter.cc | 3 +- Build/source/libs/poppler/poppler-src/goo/gdir.h | 91 -- Build/source/libs/poppler/poppler-src/goo/gfile.cc | 1 - Build/source/libs/poppler/poppler-src/goo/gfile.h | 49 + Build/source/libs/poppler/poppler-src/goo/gmem.cc | 322 ++++++ Build/source/libs/poppler/poppler-src/goo/gmem.h | 184 +--- .../source/libs/poppler/poppler-src/goo/gmempp.cc | 32 + .../libs/poppler/poppler-src/poppler/Annot.cc | 188 ++-- .../libs/poppler/poppler-src/poppler/Annot.h | 38 +- .../libs/poppler/poppler-src/poppler/Array.cc | 15 +- .../poppler/poppler-src/poppler/CairoRescaleBox.cc | 7 +- .../libs/poppler/poppler-src/poppler/Catalog.cc | 3 +- .../libs/poppler/poppler-src/poppler/Catalog.h | 3 +- .../libs/poppler/poppler-src/poppler/Dict.cc | 245 +++-- .../source/libs/poppler/poppler-src/poppler/Dict.h | 48 +- .../libs/poppler/poppler-src/poppler/Form.cc | 9 +- .../libs/poppler/poppler-src/poppler/Function.cc | 6 +- .../source/libs/poppler/poppler-src/poppler/Gfx.cc | 41 +- .../libs/poppler/poppler-src/poppler/GfxFont.cc | 3 +- .../libs/poppler/poppler-src/poppler/GfxState.cc | 26 +- .../poppler/poppler-src/poppler/GlobalParams.cc | 1 - .../poppler/poppler-src/poppler/JBIG2Stream.cc | 38 +- .../libs/poppler/poppler-src/poppler/Link.cc | 3 +- .../libs/poppler/poppler-src/poppler/Object.cc | 40 +- .../libs/poppler/poppler-src/poppler/Object.h | 77 +- .../poppler/poppler-src/poppler/OptionalContent.cc | 51 +- .../poppler/poppler-src/poppler/OptionalContent.h | 10 +- .../libs/poppler/poppler-src/poppler/OutputDev.h | 12 - .../libs/poppler/poppler-src/poppler/PDFDoc.cc | 142 +-- .../libs/poppler/poppler-src/poppler/PDFDoc.h | 46 - .../poppler/poppler-src/poppler/PSOutputDev.cc | 56 - .../libs/poppler/poppler-src/poppler/PSOutputDev.h | 4 +- .../libs/poppler/poppler-src/poppler/Parser.cc | 9 +- .../poppler/poppler-src/poppler/SignatureInfo.cc | 8 +- .../poppler/poppler-src/poppler/SignatureInfo.h | 4 +- .../poppler/poppler-src/poppler/SplashOutputDev.cc | 105 +- .../poppler/poppler-src/poppler/SplashOutputDev.h | 3 +- .../poppler/poppler-src/poppler/StructTreeRoot.cc | 3 +- .../poppler/poppler-src/poppler/StructTreeRoot.h | 3 +- .../poppler/poppler-src/poppler/TextOutputDev.cc | 5 - .../poppler/poppler-src/poppler/TextOutputDev.h | 5 - .../libs/poppler/poppler-src/poppler/XRef.cc | 4 +- .../poppler-src/poppler/poppler-config.h.cmake | 4 +- Build/source/libs/poppler/version.ac | 2 +- 57 files changed, 1034 insertions(+), 2169 deletions(-) delete mode 100644 Build/source/libs/poppler/poppler-src/goo/GooCheckedOps.h delete mode 100644 Build/source/libs/poppler/poppler-src/goo/gdir.h create mode 100644 Build/source/libs/poppler/poppler-src/goo/gmem.cc create mode 100644 Build/source/libs/poppler/poppler-src/goo/gmempp.cc (limited to 'Build') diff --git a/Build/source/libs/README b/Build/source/libs/README index eec2731f8b4..24ae054bda6 100644 --- a/Build/source/libs/README +++ b/Build/source/libs/README @@ -25,7 +25,7 @@ graphite2 1.3.12 - checked 16aug18 http://sourceforge.net/projects/silgraphite/files/graphite2/ (requires C++11) -harfbuzz 1.9.0 - checked 11sep18 +harfbuzz 1.8.8 - checked 15aug18 http://www.freedesktop.org/software/harfbuzz/release/ icu 61.1 - checked 29mar18 @@ -49,10 +49,13 @@ mpfr 4.0.1 - checked 10feb18 pixman 0.34.0 - checked 04feb16 http://cairographics.org/releases/ -poppler 0.69.0 - checked 22sep18 - http://poppler.freedesktop.org/ - used by xetex +poppler 0.68.0 - checked 20aug18 + http://poppler.freedesktop.org/ - used by luatex and xetex (requires C++11) +potrace 1.15 - checked 07aug17 + http://potrace.sourceforge.net + teckit 2.5.8 - checked 24jul18 https://github.com/silnrsi/teckit/archive/2.5.8.tar.gz diff --git a/Build/source/libs/poppler/ChangeLog b/Build/source/libs/poppler/ChangeLog index db7d9b507dd..e5cd68be0e2 100644 --- a/Build/source/libs/poppler/ChangeLog +++ b/Build/source/libs/poppler/ChangeLog @@ -1,8 +1,3 @@ -2018-09-22 Akira Kakuto - - Import poppler-0.69.0. - * Makefile.am, version.ac: Adjust. - 2018-08-20 Akira Kakuto Import poppler-0.68.0. diff --git a/Build/source/libs/poppler/Makefile.am b/Build/source/libs/poppler/Makefile.am index 949621cdfa6..e20f407f543 100644 --- a/Build/source/libs/poppler/Makefile.am +++ b/Build/source/libs/poppler/Makefile.am @@ -43,6 +43,8 @@ nodist_libpoppler_a_SOURCES = \ goo_libGoo_a_sources = \ @POPPLER_TREE@/goo/gfile.cc \ @POPPLER_TREE@/goo/glibc.cc \ + @POPPLER_TREE@/goo/gmem.cc \ + @POPPLER_TREE@/goo/gmempp.cc \ @POPPLER_TREE@/goo/grandom.cc \ @POPPLER_TREE@/goo/gstrtod.cc \ @POPPLER_TREE@/goo/FixedPoint.cc \ diff --git a/Build/source/libs/poppler/Makefile.in b/Build/source/libs/poppler/Makefile.in index e3d3ee03046..fc8765c2bde 100644 --- a/Build/source/libs/poppler/Makefile.in +++ b/Build/source/libs/poppler/Makefile.in @@ -117,6 +117,8 @@ libpoppler_a_LIBADD = am__dirstamp = $(am__leading_dot)dirstamp am__objects_1 = @POPPLER_TREE@/goo/gfile.$(OBJEXT) \ @POPPLER_TREE@/goo/glibc.$(OBJEXT) \ + @POPPLER_TREE@/goo/gmem.$(OBJEXT) \ + @POPPLER_TREE@/goo/gmempp.$(OBJEXT) \ @POPPLER_TREE@/goo/grandom.$(OBJEXT) \ @POPPLER_TREE@/goo/gstrtod.$(OBJEXT) \ @POPPLER_TREE@/goo/FixedPoint.$(OBJEXT) \ @@ -222,6 +224,8 @@ am__depfiles_remade = @POPPLER_TREE@/fofi/$(DEPDIR)/FoFiBase.Po \ @POPPLER_TREE@/goo/$(DEPDIR)/GooTimer.Po \ @POPPLER_TREE@/goo/$(DEPDIR)/gfile.Po \ @POPPLER_TREE@/goo/$(DEPDIR)/glibc.Po \ + @POPPLER_TREE@/goo/$(DEPDIR)/gmem.Po \ + @POPPLER_TREE@/goo/$(DEPDIR)/gmempp.Po \ @POPPLER_TREE@/goo/$(DEPDIR)/grandom.Po \ @POPPLER_TREE@/goo/$(DEPDIR)/gstrtod.Po \ @POPPLER_TREE@/poppler/$(DEPDIR)/Annot.Po \ @@ -529,6 +533,8 @@ nodist_libpoppler_a_SOURCES = \ goo_libGoo_a_sources = \ @POPPLER_TREE@/goo/gfile.cc \ @POPPLER_TREE@/goo/glibc.cc \ + @POPPLER_TREE@/goo/gmem.cc \ + @POPPLER_TREE@/goo/gmempp.cc \ @POPPLER_TREE@/goo/grandom.cc \ @POPPLER_TREE@/goo/gstrtod.cc \ @POPPLER_TREE@/goo/FixedPoint.cc \ @@ -695,6 +701,11 @@ clean-noinstLIBRARIES: @POPPLER_TREE@/goo/glibc.$(OBJEXT): \ @POPPLER_TREE@/goo/$(am__dirstamp) \ @POPPLER_TREE@/goo/$(DEPDIR)/$(am__dirstamp) +@POPPLER_TREE@/goo/gmem.$(OBJEXT): @POPPLER_TREE@/goo/$(am__dirstamp) \ + @POPPLER_TREE@/goo/$(DEPDIR)/$(am__dirstamp) +@POPPLER_TREE@/goo/gmempp.$(OBJEXT): \ + @POPPLER_TREE@/goo/$(am__dirstamp) \ + @POPPLER_TREE@/goo/$(DEPDIR)/$(am__dirstamp) @POPPLER_TREE@/goo/grandom.$(OBJEXT): \ @POPPLER_TREE@/goo/$(am__dirstamp) \ @POPPLER_TREE@/goo/$(DEPDIR)/$(am__dirstamp) @@ -959,6 +970,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/goo/$(DEPDIR)/GooTimer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/goo/$(DEPDIR)/gfile.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/goo/$(DEPDIR)/glibc.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/goo/$(DEPDIR)/gmem.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/goo/$(DEPDIR)/gmempp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/goo/$(DEPDIR)/grandom.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/goo/$(DEPDIR)/gstrtod.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/Annot.Po@am__quote@ # am--include-marker @@ -1408,6 +1421,8 @@ distclean: distclean-recursive -rm -f @POPPLER_TREE@/goo/$(DEPDIR)/GooTimer.Po -rm -f @POPPLER_TREE@/goo/$(DEPDIR)/gfile.Po -rm -f @POPPLER_TREE@/goo/$(DEPDIR)/glibc.Po + -rm -f @POPPLER_TREE@/goo/$(DEPDIR)/gmem.Po + -rm -f @POPPLER_TREE@/goo/$(DEPDIR)/gmempp.Po -rm -f @POPPLER_TREE@/goo/$(DEPDIR)/grandom.Po -rm -f @POPPLER_TREE@/goo/$(DEPDIR)/gstrtod.Po -rm -f @POPPLER_TREE@/poppler/$(DEPDIR)/Annot.Po @@ -1532,6 +1547,8 @@ maintainer-clean: maintainer-clean-recursive -rm -f @POPPLER_TREE@/goo/$(DEPDIR)/GooTimer.Po -rm -f @POPPLER_TREE@/goo/$(DEPDIR)/gfile.Po -rm -f @POPPLER_TREE@/goo/$(DEPDIR)/glibc.Po + -rm -f @POPPLER_TREE@/goo/$(DEPDIR)/gmem.Po + -rm -f @POPPLER_TREE@/goo/$(DEPDIR)/gmempp.Po -rm -f @POPPLER_TREE@/goo/$(DEPDIR)/grandom.Po -rm -f @POPPLER_TREE@/goo/$(DEPDIR)/gstrtod.Po -rm -f @POPPLER_TREE@/poppler/$(DEPDIR)/Annot.Po diff --git a/Build/source/libs/poppler/TLpatches/ChangeLog b/Build/source/libs/poppler/TLpatches/ChangeLog index fb96bc15078..418de163d1c 100644 --- a/Build/source/libs/poppler/TLpatches/ChangeLog +++ b/Build/source/libs/poppler/TLpatches/ChangeLog @@ -1,7 +1,3 @@ -2018-09-22 Akira Kakuto - - * patch-03-time: Adapted. - 2018-08-20 Akira Kakuto * patch-03-time: Adapted. diff --git a/Build/source/libs/poppler/TLpatches/TL-Changes b/Build/source/libs/poppler/TLpatches/TL-Changes index 113c41807b5..3a36f6927f8 100644 --- a/Build/source/libs/poppler/TLpatches/TL-Changes +++ b/Build/source/libs/poppler/TLpatches/TL-Changes @@ -1,12 +1,9 @@ -Changes applied to the poppler-0.69.0 tree as obtained from: +Changes applied to the poppler-0.68.0 tree as obtained from: http://poppler.freedesktop.org/ Removed unused dirs: cmake cpp glib qt5 test utils -Removed unused file: - .gitlab-ci.yml - Removed unused files in splash: only SplashTypes.h is used diff --git a/Build/source/libs/poppler/TLpatches/patch-03-time b/Build/source/libs/poppler/TLpatches/patch-03-time index ce313dcf175..6b9d3d12a56 100644 --- a/Build/source/libs/poppler/TLpatches/patch-03-time +++ b/Build/source/libs/poppler/TLpatches/patch-03-time @@ -1,6 +1,6 @@ -diff -ur poppler-0.69.0/goo/gfile.h poppler-src/goo/gfile.h ---- poppler-0.69.0/goo/gfile.h Sat Sep 22 06:41:09 2018 -+++ poppler-src/goo/gfile.h Sat Sep 22 15:30:17 2018 +diff -ur poppler-0.68.0/goo/gfile.h poppler-src/goo/gfile.h +--- poppler-0.68.0/goo/gfile.h Mon Aug 20 06:37:51 2018 ++++ poppler-src/goo/gfile.h Mon Aug 20 11:17:15 2018 @@ -51,8 +51,6 @@ # include # endif @@ -10,9 +10,9 @@ diff -ur poppler-0.69.0/goo/gfile.h poppler-src/goo/gfile.h #else # include # include -diff -ur poppler-0.69.0/poppler/Form.h poppler-src/poppler/Form.h ---- poppler-0.69.0/poppler/Form.h Sat Sep 22 06:41:09 2018 -+++ poppler-src/poppler/Form.h Sat Sep 22 15:30:57 2018 +diff -ur poppler-0.68.0/poppler/Form.h poppler-src/poppler/Form.h +--- poppler-0.68.0/poppler/Form.h Mon Aug 20 06:37:51 2018 ++++ poppler-src/poppler/Form.h Mon Aug 20 11:18:08 2018 @@ -36,6 +36,7 @@ #include diff --git a/Build/source/libs/poppler/configure b/Build/source/libs/poppler/configure index d77ad4469b6..906dee62485 100755 --- a/Build/source/libs/poppler/configure +++ b/Build/source/libs/poppler/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for poppler (TeX Live) 0.69.0. +# Generated by GNU Autoconf 2.69 for poppler (TeX Live) 0.68.0. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='poppler (TeX Live)' PACKAGE_TARNAME='poppler--tex-live-' -PACKAGE_VERSION='0.69.0' -PACKAGE_STRING='poppler (TeX Live) 0.69.0' +PACKAGE_VERSION='0.68.0' +PACKAGE_STRING='poppler (TeX Live) 0.68.0' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1307,7 +1307,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures poppler (TeX Live) 0.69.0 to adapt to many kinds of systems. +\`configure' configures poppler (TeX Live) 0.68.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1374,7 +1374,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of poppler (TeX Live) 0.69.0:";; + short | recursive ) echo "Configuration of poppler (TeX Live) 0.68.0:";; esac cat <<\_ACEOF @@ -1487,7 +1487,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -poppler (TeX Live) configure 0.69.0 +poppler (TeX Live) configure 0.68.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2134,7 +2134,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by poppler (TeX Live) $as_me 0.69.0, which was +It was created by poppler (TeX Live) $as_me 0.68.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4057,7 +4057,7 @@ fi # Define the identity of the package. PACKAGE='poppler--tex-live-' - VERSION='0.69.0' + VERSION='0.68.0' # Some tools Automake needs. @@ -7647,7 +7647,7 @@ ac_config_headers="$ac_config_headers poppler-config.h:poppler-src/poppler/poppl cat >>confdefs.h <<_ACEOF -#define POPPLER_VERSION "0.69.0" +#define POPPLER_VERSION "0.68.0" _ACEOF @@ -8341,7 +8341,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by poppler (TeX Live) $as_me 0.69.0, which was +This file was extended by poppler (TeX Live) $as_me 0.68.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8407,7 +8407,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -poppler (TeX Live) config.status 0.69.0 +poppler (TeX Live) config.status 0.68.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/poppler/poppler-src/CMakeLists.txt b/Build/source/libs/poppler/poppler-src/CMakeLists.txt index b664e5f3d9a..cf3a542389e 100644 --- a/Build/source/libs/poppler/poppler-src/CMakeLists.txt +++ b/Build/source/libs/poppler/poppler-src/CMakeLists.txt @@ -30,11 +30,11 @@ if (ECM_FOUND) endif() set(POPPLER_MAJOR_VERSION "0") -set(POPPLER_MINOR_VERSION "69") +set(POPPLER_MINOR_VERSION "68") set(POPPLER_MICRO_VERSION "0") set(POPPLER_VERSION "${POPPLER_MAJOR_VERSION}.${POPPLER_MINOR_VERSION}.${POPPLER_MICRO_VERSION}") -set (CMAKE_CXX_STANDARD 14) +set (CMAKE_CXX_STANDARD 11) set (CMAKE_CXX_EXTENSIONS OFF) # command line switches @@ -315,9 +315,11 @@ configure_file(poppler/poppler-config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/popple set(poppler_SRCS goo/gfile.cc + goo/gmempp.cc goo/GooList.cc goo/GooTimer.cc goo/GooString.cc + goo/gmem.cc goo/FixedPoint.cc goo/NetPBMWriter.cc goo/PNGWriter.cc @@ -487,7 +489,7 @@ add_library(poppler STATIC ${poppler_SRCS}) else() add_library(poppler ${poppler_SRCS}) endif() -set_target_properties(poppler PROPERTIES VERSION 80.0.0 SOVERSION 80) +set_target_properties(poppler PROPERTIES VERSION 79.0.0 SOVERSION 79) if(MINGW) get_target_property(POPPLER_SOVERSION poppler SOVERSION) set_target_properties(poppler PROPERTIES SUFFIX "-${POPPLER_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}") @@ -582,11 +584,9 @@ if(ENABLE_XPDF_HEADERS) goo/GooString.h goo/gtypes.h goo/gmem.h - goo/gdir.h goo/gfile.h goo/FixedPoint.h goo/ImgWriter.h - goo/GooCheckedOps.h goo/GooLikely.h goo/gstrtod.h goo/grandom.h diff --git a/Build/source/libs/poppler/poppler-src/ChangeLog b/Build/source/libs/poppler/poppler-src/ChangeLog index 153cc6a0cb5..a5d852168ec 100644 --- a/Build/source/libs/poppler/poppler-src/ChangeLog +++ b/Build/source/libs/poppler/poppler-src/ChangeLog @@ -1,1081 +1,3 @@ -commit 2052dc60f5b7403418384237d4bad2c7faf0acee -Author: Albert Astals Cid -Date: Fri Sep 21 23:41:09 2018 +0200 - - Poppler 0.69 - - CMakeLists.txt | 4 ++-- - NEWS | 31 +++++++++++++++++++++++++++++++ - cpp/Doxyfile | 2 +- - qt5/src/CMakeLists.txt | 2 +- - qt5/src/Doxyfile | 2 +- - 5 files changed, 36 insertions(+), 5 deletions(-) - -commit 554e87a1ea76ce73b4cfe6fca5b9c1bb47502dad -Author: Albert Astals Cid -Date: Fri Sep 21 18:00:24 2018 +0200 - - offset from beginning of file can't be < 0 - - poppler/XRef.cc | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 06c344ccb8ccfafa9c506f40226ea2cce0e5f75c -Author: Adam Reichold -Date: Fri Sep 21 09:43:40 2018 +0200 - - Use deferred sorting with Dict again to avoid performance regression - - This tries to move sorting a Dict into the first find call again, - but tries - harder to make the double-checked locking work correctly so that - at least - concurrent calls to find are correct (but concurrent calls to find and - add, set or remove are still not allowed). - - poppler/Dict.cc | 24 ++++++++++++++---------- - poppler/Dict.h | 2 +- - 2 files changed, 15 insertions(+), 11 deletions(-) - -commit 22ea442de8776e7e6fa78062cb8bb224b98e736f -Author: Albert Astals Cid -Date: Thu Sep 20 23:23:56 2018 +0200 - - SplashOutputDev::drawImage: gmallocn -> checkoverflow - - oss-fuzz/10194 - - And also add a likely for the previous change in the file - - poppler/SplashOutputDev.cc | 20 +++++++++++--------- - 1 file changed, 11 insertions(+), 9 deletions(-) - -commit 8ff1bddc6a97a5f8b43ff95405f0642fb03f962b -Author: Albert Astals Cid -Date: Thu Sep 20 23:21:02 2018 +0200 - - Splash::scaleImageYdXd: gmallocn -> gmallocn_checkoverflow - - oss-fuzz/10205 - - splash/Splash.cc | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -commit cf25cd0c4893b62a9993034079a6c89c6ca370ee -Author: Albert Astals Cid -Date: Thu Sep 20 23:17:06 2018 +0200 - - SplashOutputDev::drawSoftMaskedImage: gmallocn -> - gmallocn_checkoverflow - - oss-fuzz/10298 - - poppler/SplashOutputDev.cc | 18 ++++++++++-------- - 1 file changed, 10 insertions(+), 8 deletions(-) - -commit b5db021a71e38d56079cbcfcaf3345765e9ed782 -Author: Albert Astals Cid -Date: Thu Sep 20 23:10:55 2018 +0200 - - GfxUnivariateShading::setupCache: gmallocn -> gmallocn_checkoverflow - - oss-fuzz/10508 - - poppler/GfxState.cc | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -commit ab1b051a9f65b7f8e4dc9f8f9c28a0aff0c86596 -Author: Albert Astals Cid -Date: Thu Sep 20 23:05:55 2018 +0200 - - Remove unused variable - - poppler/Gfx.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit d1a4c5a9faf95618fc302c358021a745afc0527c -Author: Denis Onishchenko -Date: Thu Sep 20 22:57:03 2018 +0200 - - Fix 2 errors in computation of type3 glyphs transformation matrix - - poppler/Gfx.cc | 28 +++++++++++++--------------- - 1 file changed, 13 insertions(+), 15 deletions(-) - -commit 5dadcc93c4d4d44d0ec3bdc6bb54851f6ffaee98 -Author: Tobias Deiminger -Date: Sun Sep 9 09:28:22 2018 +0200 - - Compile Qt5 frontend with -DQT_STRICT_ITERATORS - - QT_STRICT_ITERATORS prevents conversion from non-const iterator to - const iterator. - - It helps detecting situations where we waste resources due to - needless detach from implicitely shared container data (i.e. deep - copy). - - If anyone should run into problems, they can disable strict iterators - using a global cache variable: - - $ cmake DENABLE_QT_STRICT_ITERATORS=OFF [...] - - qt5/CMakeLists.txt | 5 +++++ - 1 file changed, 5 insertions(+) - -commit 3105b61e0912df397dd712632d8ea16269ff4d94 -Author: Albert Astals Cid -Date: Wed Sep 19 23:17:07 2018 +0200 - - Update (C) - - poppler/OptionalContent.h | 1 + - poppler/StructTreeRoot.cc | 1 + - poppler/StructTreeRoot.h | 1 + - qt5/src/poppler-link.cc | 1 + - qt5/src/poppler-optcontent.cc | 1 + - 5 files changed, 5 insertions(+) - -commit 5bbb2fc4b159b003a22a9d3327ba290a7bba15f0 -Author: Adam Reichold -Date: Tue Sep 18 21:36:13 2018 +0200 - - Add a separate build job using Ubuntu 14.04 and GCC 4.9 to - compatibility with older systems. - - .gitlab-ci.yml | 35 +++++++++++++++++++++++++++-------- - 1 file changed, 27 insertions(+), 8 deletions(-) - -commit 560b34a6e2d3fd58edfb5f0af751f1aa7d3dc3d8 -Author: Adam Reichold -Date: Tue Sep 18 11:35:55 2018 +0200 - - Prevent leaking OptionalContentGroup by using unique_ptr as early - as possible. oss-fuzz/10418 - - poppler/OptionalContent.cc | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -commit 7ac84c1d633b49d69b1ec80606fdca8ee14d80e0 -Author: Oliver Sander -Date: Tue Sep 18 11:18:33 2018 +0200 - - Document the new 'ArthurFontID' type - - qt5/src/ArthurOutputDev.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 5048bec585be382f9d37110c6b2e16d26d29d5b2 -Author: Oliver Sander -Date: Tue Sep 18 11:02:58 2018 +0200 - - Bugfix: Do not disregard Ref::gen when using Ref as a cache key - - According to Leonard Rosenthol's book, the 'gen' field of a - reference is almost always zero. However, this doesn't mean that - it can be ignored when comparing two Refs. - - Incidentally, this patch also makes use of the recently introduced - Ref::operator<, which allows to replace the small custom class - ArthurFontID by a std::pair. - - qt5/src/ArthurOutputDev.h | 14 +------------- - 1 file changed, 1 insertion(+), 13 deletions(-) - -commit 7e9b6f1dba716e7adba1ed2ecd765b207def9747 -Author: Adam Reichold -Date: Sat Sep 15 09:54:01 2018 +0200 - - Fix TODO in OCGs by creating a look-up table from Ref to - OptionalContentGroup (and make Ref a regular type to do so). - - glib/poppler-document.cc | 12 ++++-------- - poppler/Object.h | 31 +++++++++++++++++++++++++------ - poppler/OptionalContent.cc | 42 - ++++++++++-------------------------------- - poppler/OptionalContent.h | 9 +++++---- - poppler/StructTreeRoot.cc | 2 +- - poppler/StructTreeRoot.h | 2 +- - qt5/src/poppler-link.cc | 5 ----- - qt5/src/poppler-optcontent.cc | 9 ++++----- - utils/pdfinfo.cc | 2 +- - 9 files changed, 51 insertions(+), 63 deletions(-) - -commit 94527d5a61eb3402b49436b978bad69f71884051 -Author: Adam Reichold -Date: Sat Sep 15 09:31:37 2018 +0200 - - Check for Ref type before unwrapping Object as such - - oss-fuzz/10359 - - poppler/OptionalContent.cc | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -commit 3af4c151cf09e1e98d311e8308060eb832bdd7d2 -Author: Adam Reichold -Date: Sun Sep 2 13:48:17 2018 +0200 - - Make Object::takeString leave a dead object instead of a null string - and hence assert non-null strings during object creation. - - poppler/Object.h | 8 +++----- - 1 file changed, 3 insertions(+), 5 deletions(-) - -commit a238d170dd89e27efd44ea09126b84272c0ac47b -Author: Tobias Deiminger -Date: Fri Sep 7 16:30:48 2018 +0200 - - Add missing newline after Tf in setTextFont - - Until now AnnotAppearanceBuilder::setTextFont was only used to write - last operation in apperance string for /DA. There you don't notice - the missing delimiter. Delimiter will however be required in general, - e.g. when writing appearance string for /AP. - - poppler/Annot.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 1acbe6af40e598b3afae18709eb32ec44d7b1afc -Author: Tobias Deiminger -Date: Sat Sep 8 12:39:25 2018 +0200 - - Fix compilation with QT_STRICT_ITERATORS - - qt5/tests/check_annotations.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 574840c5a61a9a20c930dd6fec63e6cf11bacfa5 -Author: Christian Persch -Date: Wed Sep 5 21:19:04 2018 +0200 - - goo: Split GDir and GDirEntry out of gfile.h - - This allows including gfile.h together with glib.h which has - a conflicting GDir type. - - https://gitlab.freedesktop.org/poppler/poppler/issues/370 - - CMakeLists.txt | 1 + - goo/gdir.h | 91 - +++++++++++++++++++++++++++++++++++++++++++++++++ - goo/gfile.cc | 1 + - goo/gfile.h | 49 -------------------------- - poppler/GlobalParams.cc | 1 + - 5 files changed, 94 insertions(+), 49 deletions(-) - -commit f2223e12e401648a24d559ba766759b8afac2d5e -Author: Adam Reichold -Date: Sun Sep 2 10:43:18 2018 +0200 - - Assert validity of Object contents where at least constructor or - destructor seem to assume it to catch errors as early as possible - when using debug builds. - - poppler/Object.cc | 8 ++------ - poppler/Object.h | 9 +++++---- - 2 files changed, 7 insertions(+), 10 deletions(-) - -commit 7c6c1fef6a7eab712ad335d63c5fe7ff05e6e59f -Author: Albert Astals Cid -Date: Sun Sep 2 13:32:01 2018 +0200 - - pdftotext: Fix memory leak in printLine - - utils/pdftotext.cc | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -commit e8e95d2ca4f1c108cc69cab72c7c5ab31f80a597 -Author: Sanchit Anand -Date: Tue Aug 28 02:58:39 2018 -0400 - - pdftotext: Fix only outputs first page content with -bbox-layout - option - - Issue #88 - - poppler/TextOutputDev.cc | 5 +++++ - poppler/TextOutputDev.h | 5 +++++ - utils/pdftotext.cc | 6 ++---- - 3 files changed, 12 insertions(+), 4 deletions(-) - -commit 09cc5fd1b4ef758b1f496b33bc5c5cb9e63b08eb -Author: Albert Astals Cid -Date: Sun Sep 2 13:10:45 2018 +0200 - - qt5: test: Compile with old qt - - qt5/tests/check_annotations.cpp | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -commit 042d2483c04652036ab921983b4967851f3bb8cf -Author: Albert Astals Cid -Date: Sun Sep 2 12:39:09 2018 +0200 - - Add missing (C) - - And minor style change by Albert - - poppler/Annot.cc | 6 ++++-- - poppler/Annot.h | 6 ++++-- - qt5/src/poppler-annotation-helper.h | 1 + - qt5/src/poppler-annotation.cc | 2 ++ - qt5/src/poppler-annotation.h | 1 + - 5 files changed, 12 insertions(+), 4 deletions(-) - -commit d4b4be23c8b55a118f7b9194a93a8e9da38793c1 -Author: Tobias Deiminger -Date: Sat Aug 25 23:08:39 2018 +0200 - - More review fixes - - Text color is indicated by nonstroking color in graphics state - Assumption: Text rendering mode is 'fill'. - - Increase color precision for lossless roundtrip of 16 bit integers - Our API takes QColor from user. We want to support a lossless - roundtrip - of QColor (16 bit per channel internally) through document - save and - load, and empirically found .5f is best match. - - Check only .5f case of color channel roundtrip. Include 65535. - We check if precision == 5 is sufficient, and fail if not. We - know that - precision < 5 will never work, because target set contains - less numbers - than uint16 range. - - Use smart pointer in textFont and textColor - - Add test for CMYK QColor roundtrip - - Support QColor::Cmyk to AnnotColor::colorCMYK conversion - - Add simple test for font size. Fix actual/expected args. - - Model font name as class Object, type objName - Take into account that ISO 32000 says Tf operand is always - an object of - PDF type "name". Further benefit: class Object introduces - ownership - semantcis. - - Use more std::unique_ptr and fix some coding syle - Some places assumed ownership implicitely. Make it more - explicit. - - Move parse/constructAppearanceString into DefaultAppearance - We gain cohesion and automatic memory management. - - Fix minor styling issues - - Use std::make_unique from C++14 - - poppler/Annot.cc | 163 - ++++++++++++++++++++-------------------- - poppler/Annot.h | 29 ++++--- - qt5/src/poppler-annotation.cc | 85 +++++++++++++-------- - qt5/tests/check_annotations.cpp | 66 +++++++++++----- - 4 files changed, 199 insertions(+), 144 deletions(-) - -commit b67e7ab708a0606298fd3707347bed935390d062 -Author: Adam Reichold -Date: Fri Aug 24 20:14:14 2018 +0200 - - Add a roundtrip consistency test for the text color properties - of annotations. - - qt5/tests/CMakeLists.txt | 1 + - qt5/tests/check_annotations.cpp | 75 - +++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 76 insertions(+) - -commit db0451ab16060509d13415162a95db269ca0d4f3 -Author: Tobias Deiminger -Date: Sat Aug 25 19:57:13 2018 +0200 - - Fix open review comments from #50 - - Make fontTag optional for AnnotFreeText::parseAppearanceString. - Handle fontColor == nullptr in - AnnotFreeText::constructAppearanceString. - Use AnnotAppearanceBuilder in - AnnotFreeText::constructAppearanceString. - Delete copy assignment operator for DefaultAppearance. - Rename setAppearanceString to setDefaultAppearance. - - poppler/Annot.cc | 45 - +++++++++++++++++-------------------------- - poppler/Annot.h | 8 +++++--- - qt5/src/poppler-annotation.cc | 2 +- - 3 files changed, 24 insertions(+), 31 deletions(-) - -commit 64531344de3dc663a4429e94381d68cc198d0425 -Author: Dileep Sankhla -Date: Thu Aug 23 17:48:39 2018 +0200 - - Add annotation font color - - poppler/Annot.cc | 73 +++++++++++++++++++++----- - poppler/Annot.h | 29 +++++++++-- - qt5/src/poppler-annotation-helper.h | 2 +- - qt5/src/poppler-annotation.cc | 101 - ++++++++++++++++++++++-------------- - qt5/src/poppler-annotation.h | 4 ++ - 5 files changed, 152 insertions(+), 57 deletions(-) - -commit f506b8bc52efd0781a933a44bb58d02fb000c78d -Author: Albert Astals Cid -Date: Sat Sep 1 23:54:26 2018 +0200 - - Fix handling of Signature Info Location and Reason - - We can't call GooString->getCString and just store that char * - as it belonged to us since it may very well be the inner array - of the GooString and be invalid once the GooString goes away - - poppler/Form.cc | 6 +++--- - poppler/SignatureInfo.cc | 8 ++++---- - poppler/SignatureInfo.h | 4 ++-- - 3 files changed, 9 insertions(+), 9 deletions(-) - -commit 7418616dbfc9c4e5b05b7a57f4fabed3bf9fdcb0 -Author: Albert Astals Cid -Date: Sat Sep 1 23:51:48 2018 +0200 - - Link: Fix memory leak regarding next actions - - poppler/Link.cc | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 45f0f6d21d51c0408fe1d876f18ef05489e69bc0 -Author: Evangelos Rigas -Date: Mon Aug 6 10:57:47 2018 +0100 - - [utils] Add PDF subtype to pdfinfo - - If the document is compliant with PDF A, E, VT, UA or X standard - print PDF subtype version, title, subtitle and explain the part - and conformance levels. - - utils/pdfinfo.cc | 238 - +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 238 insertions(+) - -commit 98d1b3dcc2c0530c12fb4422067c529ab375c680 -Author: Evangelos Rigas -Date: Wed Aug 22 10:51:12 2018 +0300 - - [core] Add support for PDF subtype property - - Parse /GTS_PDF(A,E,UA,VT,X)Version from the PDF Information - Dictionary into three enums: PDFSubtype, PDFSubtypePart, and - PDFSubtypeConformance. - - poppler/PDFDoc.cc | 132 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++ - poppler/PDFDoc.h | 46 +++++++++++++++++++ - 2 files changed, 178 insertions(+) - -commit 4f039c57fee4413a500a9e36bf8350eae1130442 -Author: Albert Astals Cid -Date: Sat Sep 1 01:05:02 2018 +0200 - - Update (C) from last commits - - cpp/poppler-image.cpp | 1 + - poppler/GfxState.cc | 1 + - poppler/JBIG2Stream.cc | 1 + - qt5/src/ArthurOutputDev.cc | 1 + - splash/SplashPath.cc | 1 + - 5 files changed, 5 insertions(+) - -commit 9df44cf1e0e300b751cd1c562f2b48335db72ac7 -Author: Jakub Wilk -Date: Fri Aug 31 12:05:56 2018 +0200 - - Install goo/GooCheckedOps.h - - goo/gmem.h includes goo/GooCheckedOps.h, so they should be installed - together. - - CMakeLists.txt | 1 + - 1 file changed, 1 insertion(+) - -commit 55e2b746e6bd3e495c30fe7e5154ec2c956d3faa -Author: Adam Reichold -Date: Fri Aug 31 19:17:59 2018 +0200 - - Check for allocation failure during processing of JBIG2 - streams. oss-fuzz/10146 - - poppler/JBIG2Stream.cc | 21 +++++++++++++++------ - 1 file changed, 15 insertions(+), 6 deletions(-) - -commit bb078cbd88252e421d14747b98c5c71062cf7571 -Author: Adam Reichold -Date: Fri Aug 31 20:18:23 2018 +0200 - - Always check for allocation failure after calling SplashPath::grow - and also set curSubpath to zero so that noCurrentPoint applies after - allocation failure. oss-fuzz/10148 - - splash/SplashPath.cc | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -commit f200264ddb0a16f54ae2711f399867e659957b1d -Author: Albert Astals Cid -Date: Fri Aug 31 20:03:36 2018 +0200 - - FoFiType1C::getDeltaIntArray: Fix undefined inf to int conversion - - fofi/FoFiType1C.cc | 3 +++ - 1 file changed, 3 insertions(+) - -commit 9bfc10eecb57354270806aa1d9278eebb1db2287 -Author: Adam Reichold -Date: Fri Aug 31 18:47:52 2018 +0200 - - Bump required C++ standard version to C++14 and convert a few - hopefully obvious call sites where types are repeated to using - std::make_unique. - - CMakeLists.txt | 2 +- - cpp/poppler-image.cpp | 2 +- - cpp/poppler-page.cpp | 14 +++++++------- - poppler/GfxState.cc | 2 +- - qt5/src/ArthurOutputDev.cc | 46 - +++++++++++++++++++++++++++------------------- - 5 files changed, 37 insertions(+), 29 deletions(-) - -commit d2fa4a727fc994256219a4c4f777a1c38dcc26c5 -Author: Albert Astals Cid -Date: Fri Aug 31 19:53:05 2018 +0200 - - (C) of previous commits - - fofi/FoFiType1C.cc | 1 + - poppler/SplashOutputDev.h | 1 + - 2 files changed, 2 insertions(+) - -commit 51f1c813970627db0b8804f6a729eed79ac9dfb4 -Author: Stefan Brüns -Date: Fri Aug 31 00:27:13 2018 +0200 - - SplashPath: Allocate temporary pathes on the stack - - The majority of SplashPath'es are created using - convertPath(GfxState *, GfxPath *), and are only temporary, - i.e. with function scope. - - Returning a SplashPath instead of a pointer from convertPath() - - which is cheap due to the move constructor - saves recurrent - new/delete's for each stroke/fill/... operation. - - poppler/SplashOutputDev.cc | 69 - ++++++++++++++++------------------------------ - poppler/SplashOutputDev.h | 2 +- - 2 files changed, 25 insertions(+), 46 deletions(-) - -commit a31a9e1b9a1eefcea4c8e08f2d84deb0ac6cc4ae -Author: Stefan Brüns -Date: Fri Aug 31 00:23:32 2018 +0200 - - SplashPath: Add move constructor - - After moving, the new SplashPath is in the same state as it - has been copy constructed, the moved from is in the same - state as default constructed, i.e. empty. - - splash/SplashPath.cc | 17 +++++++++++++++++ - splash/SplashPath.h | 1 + - 2 files changed, 18 insertions(+) - -commit 2190b9997ac786189368fc03e46e540c308f11b5 -Author: Stefan Brüns -Date: Wed Aug 29 00:21:57 2018 +0200 - - Allocate temporary SplashXPath on the stack - - SplashXPath is only used inside the each fill function, but newer - passed to the outside. As it is small, there is no reason not to - allocate it on the stack. - - splash/Splash.cc | 36 +++++++++++++----------------------- - 1 file changed, 13 insertions(+), 23 deletions(-) - -commit 38caf0adac8811e663b51656638177397f1400f6 -Author: Albert Astals Cid -Date: Fri Aug 31 10:00:15 2018 +0200 - - Add clang + libc++ testing pipeline - - Would have catched the missing array include in PSOutputDev - - .gitlab-ci.yml | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -commit 4244a048e55d7cce0caddc68b6bb21983e670bc4 -Author: Adam Reichold -Date: Fri Aug 31 07:33:31 2018 +0200 - - Replace #pragma once by standard-supported include guards and add - missing copyright preamble for new header. - - goo/GooCheckedOps.h | 15 ++++++++++++++- - goo/gmem.h | 5 ++++- - 2 files changed, 18 insertions(+), 2 deletions(-) - -commit 5671d3acc6a723ac3cb63866e2f429e0f0075c68 -Author: Adam Reichold -Date: Thu Aug 30 21:27:13 2018 +0200 - - Extend checked operations header with support for Clang in addition - to checking for GCC version 5 or later. - - goo/GooCheckedOps.h | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -commit ed28a5612fc0bf8580ccd360ae086fc715d19b35 -Author: Adam Reichold -Date: Thu Aug 30 20:56:33 2018 +0200 - - Fix delta decoding for Type1C fonts to avoid signed integer - overflow. oss-fuzz/8424 - - fofi/FoFiType1C.cc | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -commit de20e92a70e73d828984f41f52212051fba51700 -Author: Adam Reichold -Date: Thu Aug 30 20:54:17 2018 +0200 - - Factor out overflow-checked multiplication into a separate header - for extension and reuse. - - goo/GooCheckedOps.h | 32 ++++++++++++++++++++++++++++++++ - goo/gmem.h | 16 ++-------------- - 2 files changed, 34 insertions(+), 14 deletions(-) - -commit 3407c5c8003e67deba2b477741ac471927d40f14 -Author: Adam Reichold -Date: Fri Aug 31 07:38:34 2018 +0200 - - Reintroduce the assertion in Array::remove since there it is not - possible to check any return value. - - poppler/Array.cc | 1 + - 1 file changed, 1 insertion(+) - -commit 2c25d197c921e292f49aa2b25f4006acd57c1440 -Author: Adam Reichold -Date: Thu Aug 30 20:26:55 2018 +0200 - - Remove index out of range assertions from Array getters - - A lot of code seems to have been incompatible with the recently - removed DEBUG_MEM - flag, i.e. it relied on the Array getters returning a null object - when the index - was out of range and rather checked the returned object type (since - they had to do - that in any case) than the index. - - Due to this, debug builds became much harder to test, especially - using fuzzing. This - commit thereby removes the assertions to restore the situation when - DEBUG_MEM was - present but disabeld by default and should thereby fix oss-fuzz/10121. - - poppler/Array.cc | 3 --- - 1 file changed, 3 deletions(-) - -commit 987bbb684e688651e3d06502e2ff9b6f08130538 -Author: Albert Astals Cid -Date: Thu Aug 30 22:49:19 2018 +0200 - - PSOutputDev: Hopefully fix compilation under MSVC - - poppler/PSOutputDev.cc | 1 + - 1 file changed, 1 insertion(+) - -commit df818b383cf4fa402b89f7b2dd0f958a749a4790 -Author: Albert Astals Cid -Date: Thu Aug 30 20:46:20 2018 +0200 - - SplashPath: Fix overflow check - - What signals overflow is size being 0 not length being 0 - - splash/SplashPath.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 23d570a6f47bc9bc7bf0bcb5dd561885c9a2c55a -Author: Albert Astals Cid -Date: Thu Aug 30 18:54:55 2018 +0200 - - SplashPath: Check for overflow - - fixes oss-fuzz/10120 - - splash/SplashPath.cc | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -commit ad107bbb8e4d8eb1a23e530d040d5b11bb8ff859 -Author: Albert Astals Cid -Date: Thu Aug 30 18:28:50 2018 +0200 - - JBIG2Bitmap: Fix overflow check - - Fixes oss-fuzz/10113 - - poppler/JBIG2Stream.cc | 16 +++++++++------- - 1 file changed, 9 insertions(+), 7 deletions(-) - -commit e3a3e3fa996f318c36f9926fa8cc5dfc9edfac20 -Author: Philipp Knechtges -Date: Sun Aug 26 19:37:29 2018 +0200 - - PSOutputDev: add native support for type 7 shadings when using level 3 - - Type 7 shadings are identical for PS and PDF, so we can just emit - the corresponding - information rather than tiling the whole domain. - - poppler/PSOutputDev.cc | 55 - ++++++++++++++++++++++++++++++++++++++++++++++++++ - poppler/PSOutputDev.h | 4 +++- - 2 files changed, 58 insertions(+), 1 deletion(-) - -commit de34900993bff73c8da651319027b2fa8c490172 -Author: Ed Porras -Date: Sun Aug 26 20:24:23 2018 +0200 - - fix macOS compilation due to boolean define in jpeglib - - typedef enum { FALSE = 0, TRUE = 1 } boolean; - - goo/JpegWriter.cc | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit be05f7640ca13a6eb327dfac0073acc5dae1e3b4 -Author: Albert Astals Cid -Date: Wed Aug 29 19:02:34 2018 +0200 - - Add (c) of the last few commits - - goo/gmem.h | 1 + - poppler/Array.cc | 1 + - poppler/CairoRescaleBox.cc | 1 + - poppler/GfxFont.cc | 1 + - poppler/Object.cc | 1 + - poppler/poppler-config.h.cmake | 1 + - utils/pdfdetach.cc | 1 + - utils/pdffonts.cc | 1 + - utils/pdfimages.cc | 1 + - utils/pdfinfo.cc | 1 + - utils/pdftocairo.cc | 1 + - utils/pdftohtml.cc | 1 + - utils/pdftoppm.cc | 2 +- - utils/pdftops.cc | 1 + - utils/pdftotext.cc | 1 + - 15 files changed, 15 insertions(+), 1 deletion(-) - -commit 7d523aeae16daf2d504c058031fff90a1a17bf64 -Author: Adam Reichold -Date: Mon Aug 27 20:03:17 2018 +0200 - - Use GCC instrinsics to perform overflow checking in the gmem - allocation functions. - - goo/gmem.h | 4 ++++ - 1 file changed, 4 insertions(+) - -commit 2b4371b434b27874b64742dcd885e4f303082810 -Author: Adam Reichold -Date: Mon Aug 27 19:55:44 2018 +0200 - - Turn gmem into a header-only wrapper to allow unnecessary branches - to be optimized away and function call overhead to be aovided. - - CMakeLists.txt | 1 - - goo/gmem.cc | 171 - ----------------------------------------- - goo/gmem.h | 185 - +++++++++++++++++++++++++++++++++++---------- - poppler/CairoRescaleBox.cc | 6 +- - poppler/GfxFont.cc | 2 +- - 5 files changed, 147 insertions(+), 218 deletions(-) - -commit c362ab1b97f20c5b73b3bad8d52015f679178748 -Author: Adam Reichold -Date: Mon Aug 27 19:42:29 2018 +0200 - - Remove DEBUG_MEM from Object since this uses RAII now and hence - cannot leak. (The existing tracking also is not thread-safe and - hence unreliable.) - - poppler/Object.cc | 31 ------------------------------- - poppler/Object.h | 17 ----------------- - poppler/poppler-config.h.cmake | 3 +-- - utils/pdfdetach.cc | 3 --- - utils/pdffonts.cc | 3 --- - utils/pdfimages.cc | 3 --- - utils/pdfinfo.cc | 3 --- - utils/pdftocairo.cc | 3 --- - utils/pdftohtml.cc | 3 --- - utils/pdftoppm.cc | 3 --- - utils/pdftops.cc | 3 --- - utils/pdftotext.cc | 3 --- - 12 files changed, 1 insertion(+), 77 deletions(-) - -commit 122b3ca5838f9648646d7a2940badaae86756f03 -Author: Adam Reichold -Date: Mon Aug 27 19:39:20 2018 +0200 - - Replace specific DEBUG_MEM in Array implementation by debug - assertions. - - poppler/Array.cc | 16 ++++------------ - 1 file changed, 4 insertions(+), 12 deletions(-) - -commit f89446f6917a869b0f1a80fcc8ce81a7213dade4 -Author: Adam Reichold -Date: Mon Aug 27 19:37:25 2018 +0200 - - Remove generic heap debugging from gmem since external tools and - compiler instrumentation achieve the same effect. - - goo/gmem.cc | 151 - ---------------------------------------------------- - goo/gmem.h | 9 ---- - utils/pdfdetach.cc | 1 - - utils/pdffonts.cc | 1 - - utils/pdfimages.cc | 1 - - utils/pdfinfo.cc | 1 - - utils/pdftocairo.cc | 1 - - utils/pdftohtml.cc | 1 - - utils/pdftoppm.cc | 1 - - utils/pdftops.cc | 1 - - utils/pdftotext.cc | 1 - - 11 files changed, 169 deletions(-) - -commit 38b67245941a8672372953142b06c80cd0a142c0 -Author: Adam Reichold -Date: Mon Aug 27 19:27:41 2018 +0200 - - Remove gmempp implementing C++ memory allocation operators using - gmalloc for heap debugging. - - CMakeLists.txt | 1 - - goo/gmempp.cc | 32 -------------------------------- - 2 files changed, 33 deletions(-) - -commit d62d65c21f01c7b0a7c28adebcab43d667bcaed9 -Author: Adam Reichold -Date: Sat Aug 25 20:06:13 2018 +0200 - - Use --output-on-failure ctest flag to make failed CI runs more - informative. - - .gitlab-ci.yml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 93b214986aa89bc085c7937f63e5eafe795d985c -Author: Adam Reichold -Date: Fri Aug 24 07:42:52 2018 +0200 - - Reconstruct iterator via index arithmetic instead of relying on a - non-standard constructor to fix builds on MSVC. - - poppler/Dict.cc | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit dcd8ad25023db542ade5edc23fc5f943d8ee6376 -Author: Albert Astals Cid -Date: Thu Aug 23 23:07:41 2018 +0200 - - Also delete Object::dictAdd that takes a char * - - Makes sure noone gets a char * -> const char * promotion via Object - - poppler/Object.h | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit d63564b2bca955c7ef6ec694e3c64f9e4ee46d57 -Author: Albert Astals Cid -Date: Thu Aug 23 23:10:57 2018 +0200 - - Add Adam's copyright for the last patchset - - poppler/Annot.cc | 1 + - poppler/Catalog.cc | 1 + - poppler/Catalog.h | 1 + - poppler/Dict.cc | 1 + - poppler/Dict.h | 1 + - poppler/Form.cc | 1 + - poppler/Object.h | 1 + - poppler/PDFDoc.cc | 2 +- - poppler/Parser.cc | 1 + - utils/pdfunite.cc | 1 + - 10 files changed, 10 insertions(+), 1 deletion(-) - -commit ff2b670062d1315435b418f7ce47b28adb4b789b -Author: Adam Reichold -Date: Thu Aug 23 20:29:08 2018 +0200 - - Delete the previously ownership taking overload of Dict::add to - avoid unexpected memory leaks due to the initial API change. - - poppler/Dict.h | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -commit 8cb364059d3a8d502811565acd166116dbcd0785 -Author: Adam Reichold -Date: Tue May 8 18:54:32 2018 +0200 - - Adjust all users of Dict::add to avoid leaking memory due to by now - unnecessary calls to copyString. - - poppler/Annot.cc | 28 ++++++++++++++-------------- - poppler/Gfx.cc | 9 +++------ - poppler/Object.h | 4 ++-- - poppler/PDFDoc.cc | 8 ++++---- - poppler/Parser.cc | 8 +++----- - utils/pdfunite.cc | 4 ++-- - 6 files changed, 28 insertions(+), 33 deletions(-) - -commit d479e37d34435c6afedf1343a7f60334f351220c -Author: Adam Reichold -Date: Tue May 8 18:19:03 2018 +0200 - - Fix linking errors in release builds due to non exported weak symbols. - - poppler/Dict.cc | 4 ++++ - poppler/Dict.h | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -commit d4230e3b72d22a24ffe747891a15635ebf0df628 -Author: Adam Reichold -Date: Tue May 8 08:32:03 2018 +0200 - - But do use swap-and-pop if the Dict is still small enough to be - unsorted. - - poppler/Dict.cc | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -commit ca202af16ac9bd177d7417f3e74b8987e9256bc6 -Author: Adam Reichold -Date: Mon May 7 22:58:43 2018 +0200 - - Try to simplify Dict by implementing it in terms of std::vector - and std::string. - - poppler/Catalog.cc | 2 +- - poppler/Catalog.h | 2 +- - poppler/Dict.cc | 240 - ++++++++++++++++------------------------------------- - poppler/Dict.h | 46 +++++----- - poppler/Form.cc | 2 +- - poppler/Object.h | 4 +- - 6 files changed, 99 insertions(+), 197 deletions(-) - -commit 670171ba7507bc8ea39c3a33316c86b68fed5e0d -Author: Albert Astals Cid -Date: Thu Aug 23 18:11:45 2018 +0200 - - Don't abort if the SampleFunction has too many samples - - Fixes issue #634 - - poppler/Function.cc | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -commit 5fbce88ec9f6d360c5b6436837dfa760c8fa8d95 -Author: Volker Krause -Date: Thu Aug 23 00:56:27 2018 +0200 - - Fix memory issues in GfxImageColorMap copy ctor - - - byte_lookup and lookup2 could contain uninitialized memory - - lookup2 was not copied at all - - lookup could be copied with the wrong size - - Issue #145 - - poppler/GfxState.cc | 19 +++++++++++++------ - 1 file changed, 13 insertions(+), 6 deletions(-) - -commit 2b5f35e59d234aed0805f0ea8ac5086e35837153 -Author: Oliver Sander -Date: Tue Nov 28 16:40:40 2017 +0100 - - Document the OutputDev::clip and OutputDev::oeClip methods - - poppler/OutputDev.h | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -commit 2a67883de1c896c5a8956226db7871e97724ed2b -Author: Adam Reichold -Date: Wed Aug 22 06:10:29 2018 +0200 - - Also install Curl development files since it is a default enabled - dependency. - - .gitlab-ci.yml | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit c220ef254f326866016930ac9c1c2b430fcb11ea -Author: Albert Astals Cid -Date: Wed Aug 22 00:57:33 2018 +0200 - - Fix uninitialized memory read - - Fixes oss-fuzz/10009 - - poppler/Gfx.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit b8082c67943ea7ef7c115b86cffb0785da32d227 -Author: Adam Reichold -Date: Tue Aug 21 20:21:36 2018 +0200 - - Since the CI directory is cached, we need to make sure we create it - if necessary instead of failing. - - .gitlab-ci.yml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit f1b8626e021a11d2b649be69c563a2a9af210c84 -Author: Adam Reichold -Date: Tue Aug 21 08:35:31 2018 +0200 - - Use a proper UTF-8 locale for non-ASCII file names in the tests and - rebase onto Debian unstable - - .gitlab-ci.yml | 17 ++++++++++++----- - 1 file changed, 12 insertions(+), 5 deletions(-) - -commit 534aca90732c199e96057111272afbc22796ea60 -Author: Adam Reichold -Date: Tue Aug 21 08:13:10 2018 +0200 - - Also download test-data to be able to run unit tests - - .gitlab-ci.yml | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -commit 78f8a6abed64a1b9ad320587b614ee87bc7791ab -Author: Adam Reichold -Date: Tue Aug 21 08:00:41 2018 +0200 - - Add initial GitLab CI manifest - - .gitlab-ci.yml | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - commit c666833e4163a93451eab27c675af9ca82d11593 Author: Albert Astals Cid Date: Sun Aug 19 23:37:51 2018 +0200 diff --git a/Build/source/libs/poppler/poppler-src/NEWS b/Build/source/libs/poppler/poppler-src/NEWS index e38866e2c8a..485f89ea57a 100644 --- a/Build/source/libs/poppler/poppler-src/NEWS +++ b/Build/source/libs/poppler/poppler-src/NEWS @@ -1,34 +1,3 @@ -Release 0.69.0 - core: - * Add annotation font color - * Splash: Some speed improvements - * PSOutputDev: add native support for type 7 shadings when using level 3 - * Add support for PDF subtype property - * Link: Fix memory leak regarding next actions - * Fix handling of Signature Info Location and Reason - * Fix errors in computation of type3 glyphs transformation matrix - * Reimplement Dict class in a more modern way - * Fix security issues found by oss-fuzz - * Fix memory issues in GfxImageColorMap copy ctor - * Don't abort if the SampleFunction has too many samples. Issue #634 - * Document the OutputDev::clip and OutputDev::oeClip methods - * fix macOS compilation due to boolean define in jpeglib - * Split GDir and GDirEntry out of gfile.h. Issue #370 - - qt5: - * Add annotation font color - - cpp: - - utils: - * pdfinfo: Show PDF subtype - * pdftotext: Fix only outputs first page content with -bbox-layout option. Issue #88 - * pdftotext: Fix memory leak in printLine - - - build system: - * Require C++14 - Release 0.68.0 core: * Add Reason and Location to SignatureInfo. Bug #107299 diff --git a/Build/source/libs/poppler/poppler-src/fofi/FoFiType1C.cc b/Build/source/libs/poppler/poppler-src/fofi/FoFiType1C.cc index ebf68a44e94..caa4b42b6cf 100644 --- a/Build/source/libs/poppler/poppler-src/fofi/FoFiType1C.cc +++ b/Build/source/libs/poppler/poppler-src/fofi/FoFiType1C.cc @@ -15,7 +15,6 @@ // // Copyright (C) 2009, 2010, 2017, 2018 Albert Astals Cid // Copyright (C) 2012 Thomas Freitag -// Copyright (C) 2018 Adam Reichold // // 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 @@ -2664,14 +2663,7 @@ int FoFiType1C::getDeltaIntArray(int *arr, int maxLen) { } x = 0; for (i = 0; i < n; ++i) { - int y; - if (unlikely(isinf(ops[i].num))) { - return i; - } - if (checkedAdd(x, (int)ops[i].num, &y)) { - return i; - } - x = y; + x += (int)ops[i].num; arr[i] = x; } return n; diff --git a/Build/source/libs/poppler/poppler-src/goo/GooCheckedOps.h b/Build/source/libs/poppler/poppler-src/goo/GooCheckedOps.h deleted file mode 100644 index 3da6b337f64..00000000000 --- a/Build/source/libs/poppler/poppler-src/goo/GooCheckedOps.h +++ /dev/null @@ -1,49 +0,0 @@ -//======================================================================== -// -// GooCheckedOps.h -// -// This file is licensed under the GPLv2 or later -// -// Copyright (C) 2018 Adam Reichold -// -//======================================================================== - -#ifndef GOO_CHECKED_OPS_H -#define GOO_CHECKED_OPS_H - -#include - -inline bool checkedAssign(long long lz, int *z) { - static_assert(LLONG_MAX > INT_MAX, "Need type larger than int to perform overflow checks."); - - if (lz > INT_MAX || lz < INT_MIN) { - return true; - } - - *z = static_cast(lz); - return false; -} - -#ifndef __has_builtin - #define __has_builtin(x) 0 -#endif - -inline bool checkedAdd(int x, int y, int *z) { -#if __GNUC__ >= 5 || __has_builtin(__builtin_sadd_overflow) - return __builtin_sadd_overflow(x, y, z); -#else - const auto lz = static_cast(x) + static_cast(y); - return checkedAssign(lz, z); -#endif -} - -inline bool checkedMultiply(int x, int y, int *z) { -#if __GNUC__ >= 5 || __has_builtin(__builtin_smul_overflow) - return __builtin_smul_overflow(x, y, z); -#else - const auto lz = static_cast(x) * static_cast(y); - return checkedAssign(lz, z); -#endif -} - -#endif // GOO_CHECKED_OPS_H diff --git a/Build/source/libs/poppler/poppler-src/goo/JpegWriter.cc b/Build/source/libs/poppler/poppler-src/goo/JpegWriter.cc index 26fa77a7ca6..16c97afe768 100644 --- a/Build/source/libs/poppler/poppler-src/goo/JpegWriter.cc +++ b/Build/source/libs/poppler/poppler-src/goo/JpegWriter.cc @@ -11,7 +11,6 @@ // Copyright (C) 2013 Peter Breitenlohner // Copyright (C) 2017, 2018 Albert Astals Cid // Copyright (C) 2018 Martin Packman -// Copyright (C) 2018 Ed Porras // //======================================================================== @@ -144,7 +143,7 @@ bool JpegWriter::init(FILE *f, int width, int height, int hDPI, int vDPI) } // Set whether to compute optimal Huffman coding tables - priv->cinfo.optimize_coding = static_cast(priv->optimize); + priv->cinfo.optimize_coding = priv->optimize; // Get ready for data jpeg_start_compress(&priv->cinfo, TRUE); diff --git a/Build/source/libs/poppler/poppler-src/goo/gdir.h b/Build/source/libs/poppler/poppler-src/goo/gdir.h deleted file mode 100644 index 1eb1dae5856..00000000000 --- a/Build/source/libs/poppler/poppler-src/goo/gdir.h +++ /dev/null @@ -1,91 +0,0 @@ -//======================================================================== -// -// gfile.h -// -// Miscellaneous file and directory name manipulation. -// -// Copyright 1996-2003 Glyph & Cog, LLC -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Kristian Høgsberg -// Copyright (C) 2009, 2011, 2012, 2017, 2018 Albert Astals Cid -// Copyright (C) 2009 Kovid Goyal -// Copyright (C) 2013 Adam Reichold -// Copyright (C) 2013, 2017 Adrian Johnson -// Copyright (C) 2014 Bogdan Cristea -// Copyright (C) 2014 Peter Breitenlohner -// Copyright (C) 2017 Christoph Cullmann -// Copyright (C) 2017 Thomas Freitag -// Copyright (C) 2018 Mojca Miklavec -// -// 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 -// -//======================================================================== - -#ifndef GDIR_H -#define GDIR_H - -#include "poppler-config.h" -#include "gtypes.h" - -class GooString; - -//------------------------------------------------------------------------ -// GDir and GDirEntry -//------------------------------------------------------------------------ - -class GDirEntry { -public: - - GDirEntry(char *dirPath, char *nameA, GBool doStat); - ~GDirEntry(); - GooString *getName() { return name; } - GooString *getFullPath() { return fullPath; } - GBool isDir() { return dir; } - -private: - GDirEntry(const GDirEntry &other); - GDirEntry& operator=(const GDirEntry &other); - - GooString *name; // dir/file name - GooString *fullPath; - GBool dir; // is it a directory? -}; - -class GDir { -public: - - GDir(char *name, GBool doStatA = gTrue); - ~GDir(); - GDirEntry *getNextEntry(); - void rewind(); - -private: - GDir(const GDir &other); - GDir& operator=(const GDir &other); - - GooString *path; // directory path - GBool doStat; // call stat() for each entry? -#if defined(_WIN32) - WIN32_FIND_DATAA ffd; - HANDLE hnd; -#elif defined(ACORN) -#elif defined(MACOS) -#else - DIR *dir; // the DIR structure from opendir() -#ifdef VMS - GBool needParent; // need to return an entry for [-] -#endif -#endif -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-src/goo/gfile.cc b/Build/source/libs/poppler/poppler-src/goo/gfile.cc index 720f75aa797..381a0ce265d 100644 --- a/Build/source/libs/poppler/poppler-src/goo/gfile.cc +++ b/Build/source/libs/poppler/poppler-src/goo/gfile.cc @@ -56,7 +56,6 @@ #include #include "GooString.h" #include "gfile.h" -#include "gdir.h" // Some systems don't define this, so just make it something reasonably // large. diff --git a/Build/source/libs/poppler/poppler-src/goo/gfile.h b/Build/source/libs/poppler/poppler-src/goo/gfile.h index e826caac37d..25595aae6d4 100644 --- a/Build/source/libs/poppler/poppler-src/goo/gfile.h +++ b/Build/source/libs/poppler/poppler-src/goo/gfile.h @@ -169,4 +169,53 @@ private: #endif // _WIN32 }; +//------------------------------------------------------------------------ +// GDir and GDirEntry +//------------------------------------------------------------------------ + +class GDirEntry { +public: + + GDirEntry(char *dirPath, char *nameA, GBool doStat); + ~GDirEntry(); + GooString *getName() { return name; } + GooString *getFullPath() { return fullPath; } + GBool isDir() { return dir; } + +private: + GDirEntry(const GDirEntry &other); + GDirEntry& operator=(const GDirEntry &other); + + GooString *name; // dir/file name + GooString *fullPath; + GBool dir; // is it a directory? +}; + +class GDir { +public: + + GDir(char *name, GBool doStatA = gTrue); + ~GDir(); + GDirEntry *getNextEntry(); + void rewind(); + +private: + GDir(const GDir &other); + GDir& operator=(const GDir &other); + + GooString *path; // directory path + GBool doStat; // call stat() for each entry? +#if defined(_WIN32) + WIN32_FIND_DATAA ffd; + HANDLE hnd; +#elif defined(ACORN) +#elif defined(MACOS) +#else + DIR *dir; // the DIR structure from opendir() +#ifdef VMS + GBool needParent; // need to return an entry for [-] +#endif +#endif +}; + #endif diff --git a/Build/source/libs/poppler/poppler-src/goo/gmem.cc b/Build/source/libs/poppler/poppler-src/goo/gmem.cc new file mode 100644 index 00000000000..f118fd715d4 --- /dev/null +++ b/Build/source/libs/poppler/poppler-src/goo/gmem.cc @@ -0,0 +1,322 @@ +/* + * gmem.c + * + * Memory routines with out-of-memory checking. + * + * Copyright 1996-2003 Glyph & Cog, LLC + */ + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2005 Takashi Iwai +// Copyright (C) 2007-2010, 2012 Albert Astals Cid +// Copyright (C) 2008 Jonathan Kew +// +// 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 +// +//======================================================================== + +#include +#include +#include +#include +#include +#include +#include "gmem.h" + +#ifdef DEBUG_MEM + +typedef struct _GMemHdr { + unsigned int magic; + int size; + int index; + struct _GMemHdr *next, *prev; +} GMemHdr; + +#define gMemHdrSize ((sizeof(GMemHdr) + 7) & ~7) +#define gMemTrlSize (sizeof(long)) + +#define gMemMagic 0xabcd9999 + +#if gmemTrlSize==8 +#define gMemDeadVal 0xdeadbeefdeadbeefUL +#else +#define gMemDeadVal 0xdeadbeefUL +#endif + +/* round data size so trailer will be aligned */ +#define gMemDataSize(size) \ + ((((size) + gMemTrlSize - 1) / gMemTrlSize) * gMemTrlSize) + +static GMemHdr *gMemHead = NULL; +static GMemHdr *gMemTail = NULL; + +static int gMemIndex = 0; +static int gMemAlloc = 0; +static int gMemInUse = 0; + +#endif /* DEBUG_MEM */ + +inline static void *gmalloc(size_t size, bool checkoverflow) { +#ifdef DEBUG_MEM + int size1; + char *mem; + GMemHdr *hdr; + void *data; + unsigned long *trl, *p; + + if (size == 0) { + return NULL; + } + size1 = gMemDataSize(size); + if (!(mem = (char *)malloc(size1 + gMemHdrSize + gMemTrlSize))) { + fprintf(stderr, "Out of memory\n"); + if (checkoverflow) return NULL; + else exit(1); + } + hdr = (GMemHdr *)mem; + data = (void *)(mem + gMemHdrSize); + trl = (unsigned long *)(mem + gMemHdrSize + size1); + hdr->magic = gMemMagic; + hdr->size = size; + hdr->index = gMemIndex++; + if (gMemTail) { + gMemTail->next = hdr; + hdr->prev = gMemTail; + gMemTail = hdr; + } else { + hdr->prev = NULL; + gMemHead = gMemTail = hdr; + } + hdr->next = NULL; + ++gMemAlloc; + gMemInUse += size; + for (p = (unsigned long *)data; p <= trl; ++p) { + *p = gMemDeadVal; + } + return data; +#else + void *p; + + if (size == 0) { + return nullptr; + } + if (!(p = malloc(size))) { + fprintf(stderr, "Out of memory\n"); + if (checkoverflow) return nullptr; + else exit(1); + } + return p; +#endif +} + +void *gmalloc(size_t size) { + return gmalloc(size, false); +} + +void *gmalloc_checkoverflow(size_t size) { + return gmalloc(size, true); +} + +inline static void *grealloc(void *p, size_t size, bool checkoverflow) { +#ifdef DEBUG_MEM + GMemHdr *hdr; + void *q; + int oldSize; + + if (size == 0) { + if (p) { + gfree(p); + } + return NULL; + } + if (p) { + hdr = (GMemHdr *)((char *)p - gMemHdrSize); + oldSize = hdr->size; + q = gmalloc(size, checkoverflow); + memcpy(q, p, size < oldSize ? size : oldSize); + gfree(p); + } else { + q = gmalloc(size, checkoverflow); + } + return q; +#else + void *q; + + if (size == 0) { + if (p) { + free(p); + } + return nullptr; + } + if (p) { + q = realloc(p, size); + } else { + q = malloc(size); + } + if (!q) { + fprintf(stderr, "Out of memory\n"); + if (checkoverflow) return nullptr; + else exit(1); + } + return q; +#endif +} + +void *grealloc(void *p, size_t size) { + return grealloc(p, size, false); +} + +void *grealloc_checkoverflow(void *p, size_t size) { + return grealloc(p, size, true); +} + +inline static void *gmallocn(int nObjs, int objSize, bool checkoverflow) { + if (nObjs == 0) { + return nullptr; + } + if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) { + fprintf(stderr, "Bogus memory allocation size\n"); + if (checkoverflow) return nullptr; + else exit(1); + } + const int n = nObjs * objSize; + return gmalloc(n, checkoverflow); +} + +void *gmallocn(int nObjs, int objSize) { + return gmallocn(nObjs, objSize, false); +} + +void *gmallocn_checkoverflow(int nObjs, int objSize) { + return gmallocn(nObjs, objSize, true); +} + +inline static void *gmallocn3(int a, int b, int c, bool checkoverflow) { + int n = a * b; + if (b <= 0 || a < 0 || a >= INT_MAX / b) { + fprintf(stderr, "Bogus memory allocation size\n"); + if (checkoverflow) return nullptr; + else exit(1); + } + return gmallocn(n, c, checkoverflow); +} + +void *gmallocn3(int a, int b, int c) { + return gmallocn3(a, b, c, false); +} + +void *gmallocn3_checkoverflow(int a, int b, int c) { + return gmallocn3(a, b, c, true); +} + +inline static void *greallocn(void *p, int nObjs, int objSize, bool checkoverflow) { + if (nObjs == 0) { + if (p) { + gfree(p); + } + return nullptr; + } + if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) { + fprintf(stderr, "Bogus memory allocation size\n"); + if (checkoverflow) { + gfree(p); + return nullptr; + } else { + exit(1); + } + } + const int n = nObjs * objSize; + return grealloc(p, n, checkoverflow); +} + +void *greallocn(void *p, int nObjs, int objSize) { + return greallocn(p, nObjs, objSize, false); +} + +void *greallocn_checkoverflow(void *p, int nObjs, int objSize) { + return greallocn(p, nObjs, objSize, true); +} + +void gfree(void *p) { +#ifdef DEBUG_MEM + int size; + GMemHdr *hdr; + unsigned long *trl, *clr; + + if (p) { + hdr = (GMemHdr *)((char *)p - gMemHdrSize); + if (hdr->magic == gMemMagic && + ((hdr->prev == NULL) == (hdr == gMemHead)) && + ((hdr->next == NULL) == (hdr == gMemTail))) { + if (hdr->prev) { + hdr->prev->next = hdr->next; + } else { + gMemHead = hdr->next; + } + if (hdr->next) { + hdr->next->prev = hdr->prev; + } else { + gMemTail = hdr->prev; + } + --gMemAlloc; + gMemInUse -= hdr->size; + size = gMemDataSize(hdr->size); + trl = (unsigned long *)((char *)hdr + gMemHdrSize + size); + if (*trl != gMemDeadVal) { + fprintf(stderr, "Overwrite past end of block %d at address %p\n", + hdr->index, p); + } + for (clr = (unsigned long *)hdr; clr <= trl; ++clr) { + *clr = gMemDeadVal; + } + free(hdr); + } else { + fprintf(stderr, "Attempted to free bad address %p\n", p); + } + } +#else + if (p) { + free(p); + } +#endif +} + +#ifdef DEBUG_MEM +void gMemReport(FILE *f) { + GMemHdr *p; + + fprintf(f, "%d memory allocations in all\n", gMemIndex); + if (gMemAlloc > 0) { + fprintf(f, "%d memory blocks left allocated:\n", gMemAlloc); + fprintf(f, " index size\n"); + fprintf(f, "-------- --------\n"); + for (p = gMemHead; p; p = p->next) { + fprintf(f, "%8d %8d\n", p->index, p->size); + } + } else { + fprintf(f, "No memory blocks left allocated\n"); + } +} +#endif + +char *copyString(const char *s) { + char *s1; + + s1 = (char *)gmalloc(strlen(s) + 1); + strcpy(s1, s); + return s1; +} + +char *gstrndup(const char *s, size_t n) { + char *s1 = (char*)gmalloc(n + 1); /* cannot return NULL for size > 0 */ + s1[n] = '\0'; + memcpy(s1, s, n); + return s1; +} diff --git a/Build/source/libs/poppler/poppler-src/goo/gmem.h b/Build/source/libs/poppler/poppler-src/goo/gmem.h index 9b187c1dafc..4c76f0fb65e 100644 --- a/Build/source/libs/poppler/poppler-src/goo/gmem.h +++ b/Build/source/libs/poppler/poppler-src/goo/gmem.h @@ -16,7 +16,6 @@ // Copyright (C) 2005 Takashi Iwai // Copyright (C) 2007-2010, 2017 Albert Astals Cid // Copyright (C) 2008 Jonathan Kew -// Copyright (C) 2018 Adam Reichold // // 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 @@ -26,155 +25,68 @@ #ifndef GMEM_H #define GMEM_H -#include -#include -#include +#include +#include "poppler-config.h" -#include "GooCheckedOps.h" +#ifdef __cplusplus +extern "C" { +#endif -/// Same as malloc, but prints error message and exits if malloc() returns NULL. -inline void *gmalloc(size_t size, bool checkoverflow = false) { - if (size == 0) { - return nullptr; - } - - if (void *p = std::malloc(size)) { - return p; - } - - std::fputs("Out of memory\n", stderr); - - if (checkoverflow) { - return nullptr; - } - - std::abort(); -} - -inline void *gmalloc_checkoverflow(size_t size) { - return gmalloc(size, true); -} - -/// Same as free, but checks for and ignores NULL pointers. -inline void gfree(void *p) { - if (p) { - std::free(p); - } -} - -/// Same as realloc, but prints error message and exits if realloc() returns NULL. -/// If

is NULL, calls malloc() instead of realloc(). -inline void *grealloc(void *p, size_t size, bool checkoverflow = false) { - if (size == 0) { - gfree(p); - return nullptr; - } - - if (void *q = p ? std::realloc(p, size) : std::malloc(size)) { - return q; - } - - std::fputs("Out of memory\n", stderr); - - if (checkoverflow) { - return nullptr; - } - - std::abort(); -} +/* + * Same as malloc, but prints error message and exits if malloc() + * returns NULL. + */ +extern void *gmalloc(size_t size); +extern void *gmalloc_checkoverflow(size_t size); -inline void *grealloc_checkoverflow(void *p, size_t size) { - return grealloc(p, size, true); -} +/* + * Same as realloc, but prints error message and exits if realloc() + * returns NULL. If

is NULL, calls malloc instead of realloc(). + */ +extern void *grealloc(void *p, size_t size); +extern void *grealloc_checkoverflow(void *p, size_t size); /* * These are similar to gmalloc and grealloc, but take an object count - * and size. The result is similar to allocating * + * and size. The result is similar to allocating nObjs * objSize * bytes, but there is an additional error check that the total size * doesn't overflow an int. * The gmallocn_checkoverflow variant returns NULL instead of exiting - * the application if a overflow is detected. + * the application if a overflow is detected */ +extern void *gmallocn(int nObjs, int objSize); +extern void *gmallocn_checkoverflow(int nObjs, int objSize); +extern void *gmallocn3(int a, int b, int c); +extern void *gmallocn3_checkoverflow(int a, int b, int c); +extern void *greallocn(void *p, int nObjs, int objSize); +extern void *greallocn_checkoverflow(void *p, int nObjs, int objSize); -inline void *gmallocn(int count, int size, bool checkoverflow = false) { - if (count == 0) { - return nullptr; - } - - int bytes; - if (count < 0 || size <= 0 || checkedMultiply(count, size, &bytes)) { - std::fputs("Bogus memory allocation size\n", stderr); - - if (checkoverflow) { - return nullptr; - } - - std::abort(); - } - - return gmalloc(bytes, checkoverflow); -} - -inline void *gmallocn_checkoverflow(int count, int size) { - return gmallocn(count, size, true); -} - -inline void *gmallocn3(int width, int height, int size, bool checkoverflow = false) { - if (width == 0 || height == 0) { - return nullptr; - } - - int count; - int bytes; - if (width < 0 || height < 0 || size <= 0 || checkedMultiply(width, height, &count) || checkedMultiply(count, size, &bytes)) { - std::fputs("Bogus memory allocation size\n", stderr); - - if (checkoverflow) { - return nullptr; - } - - std::abort(); - } - - return gmalloc(bytes, checkoverflow); -} - -inline void *greallocn(void *p, int count, int size, bool checkoverflow = false) { - if (count == 0) { - gfree(p); - return nullptr; - } - - int bytes; - if (count < 0 || size <= 0 || checkedMultiply(count, size, &bytes)) { - std::fputs("Bogus memory allocation size\n", stderr); - - if (checkoverflow) { - gfree(p); - return nullptr; - } - - std::abort(); - } +/* + * Same as free, but checks for and ignores NULL pointers. + */ +extern void gfree(void *p); - return grealloc(p, bytes, checkoverflow); -} +#ifdef DEBUG_MEM +/* + * Report on unfreed memory. + */ +extern void gMemReport(FILE *f); +#else +#define gMemReport(f) +#endif -inline void *greallocn_checkoverflow(void *p, int count, int size) { - return greallocn(p, count, size, true); -} +/* + * Allocate memory and copy a string into it. + */ +extern char *copyString(const char *s); -/// Allocate memory and copy a string into it. -inline char *copyString(const char *s) { - char *r = static_cast(gmalloc(std::strlen(s) + 1, false)); - return std::strcpy(r, s); -} +/* + * Allocate memory and copy a limited-length string to it. + */ +extern char *gstrndup(const char *s, size_t n); -/// Allocate memory and copy a limited-length string to it. -inline char *copyString(const char *s, size_t n) { - char *r = static_cast(gmalloc(n + 1, false)); - r[n] = '\0'; - return std::strncpy(r, s, n); +#ifdef __cplusplus } +#endif -#endif // GMEM_H +#endif diff --git a/Build/source/libs/poppler/poppler-src/goo/gmempp.cc b/Build/source/libs/poppler/poppler-src/goo/gmempp.cc new file mode 100644 index 00000000000..a70338ca3ce --- /dev/null +++ b/Build/source/libs/poppler/poppler-src/goo/gmempp.cc @@ -0,0 +1,32 @@ +//======================================================================== +// +// gmempp.cc +// +// Use gmalloc/gfree for C++ new/delete operators. +// +// Copyright 1996-2003 Glyph & Cog, LLC +// +//======================================================================== + +#include +#include "gmem.h" + +#ifdef DEBUG_MEM + +void *operator new(size_t size) { + return gmalloc((int)size); +} + +void *operator new[](size_t size) { + return gmalloc((int)size); +} + +void operator delete(void *p) { + gfree(p); +} + +void operator delete[](void *p) { + gfree(p); +} + +#endif diff --git a/Build/source/libs/poppler/poppler-src/poppler/Annot.cc b/Build/source/libs/poppler/poppler-src/poppler/Annot.cc index 61870bd5193..d37824c1d38 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Annot.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Annot.cc @@ -38,9 +38,6 @@ // Copyright (C) 2017 Hans-Ulrich Jüttner // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich // Copyright 2018 Andre Heinecke -// Copyright (C) 2018 Adam Reichold -// Copyright (C) 2018 Dileep Sankhla -// Copyright (C) 2018 Tobias Deiminger // // 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 @@ -794,73 +791,6 @@ Object AnnotColor::writeToObject(XRef *xref) const { } } -//------------------------------------------------------------------------ -// DefaultAppearance -//------------------------------------------------------------------------ - -DefaultAppearance::DefaultAppearance(Object &&fontNameA, double fontPtSizeA, std::unique_ptr fontColorA) : - fontName(std::move(fontNameA)), fontPtSize(fontPtSizeA), fontColor(std::move(fontColorA)) { -} - -DefaultAppearance::DefaultAppearance(GooString *da) { - fontPtSize = -1; - - if (da) { - GooList * daToks = new GooList(); - int i = FormFieldText::tokenizeDA(da, daToks, "Tf"); - - if (i >= 1) { - fontPtSize = gatof(( (GooString *)daToks->get(i-1) )->getCString()); - } - if (i >= 2) { - // We are expecting a name, therefore the first letter should be '/'. - if (((const char*)daToks->get(i-2)) && ((const char*)daToks->get(i-2))[0] == '/') { - // The +1 is here to skip the leading '/'. - fontName = Object(objName, ((const char*)daToks->get(i-2))+1); - } - } - // Scan backwards: we are looking for the last set value - for (i = daToks->getLength()-1; i >= 0; --i) { - if (!fontColor) { - if (!((GooString *)daToks->get(i))->cmp("g") && i >= 1) { - fontColor = std::make_unique(gatof(( (GooString *)daToks->get(i-1) )->getCString())); - } else if (!((GooString *)daToks->get(i))->cmp("rg") && i >= 3) { - fontColor = std::make_unique(gatof(( (GooString *)daToks->get(i-3) )->getCString()), - gatof(( (GooString *)daToks->get(i-2) )->getCString()), - gatof(( (GooString *)daToks->get(i-1) )->getCString())); - } else if (!((GooString *)daToks->get(i))->cmp("k") && i >= 4) { - fontColor = std::make_unique(gatof(( (GooString *)daToks->get(i-4) )->getCString()), - gatof(( (GooString *)daToks->get(i-3) )->getCString()), - gatof(( (GooString *)daToks->get(i-2) )->getCString()), - gatof(( (GooString *)daToks->get(i-1) )->getCString())); - } - } - } - deleteGooList(daToks, GooString); - } -} - -void DefaultAppearance::setFontName(Object &&fontNameA) { - fontName = std::move(fontNameA); -} - -void DefaultAppearance::setFontPtSize(double fontPtSizeA) { - fontPtSize = fontPtSizeA; -} - -void DefaultAppearance::setFontColor(std::unique_ptr fontColorA) { - fontColor = std::move(fontColorA); -} - -GooString *DefaultAppearance::toAppearanceString() const { - AnnotAppearanceBuilder appearBuilder; - if (fontColor) { - appearBuilder.setDrawColor(fontColor.get(), gTrue); - } - appearBuilder.setTextFont(fontName, fontPtSize); - return appearBuilder.buffer()->copy(); -} - //------------------------------------------------------------------------ // AnnotIconFit //------------------------------------------------------------------------ @@ -1686,17 +1616,17 @@ void AnnotAppearanceBuilder::setDrawColor(const AnnotColor *drawColor, GBool fil switch (drawColor->getSpace()) { case AnnotColor::colorCMYK: - appearBuf->appendf("{0:.5f} {1:.5f} {2:.5f} {3:.5f} {4:c}\n", + appearBuf->appendf("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:c}\n", values[0], values[1], values[2], values[3], fill ? 'k' : 'K'); break; case AnnotColor::colorRGB: - appearBuf->appendf("{0:.5f} {1:.5f} {2:.5f} {3:s}\n", + appearBuf->appendf("{0:.2f} {1:.2f} {2:.2f} {3:s}\n", values[0], values[1], values[2], fill ? "rg" : "RG"); break; case AnnotColor::colorGray: - appearBuf->appendf("{0:.5f} {1:c}\n", + appearBuf->appendf("{0:.2f} {1:c}\n", values[0], fill ? 'g' : 'G'); break; @@ -1706,11 +1636,6 @@ void AnnotAppearanceBuilder::setDrawColor(const AnnotColor *drawColor, GBool fil } } -void AnnotAppearanceBuilder::setTextFont(const Object &fontName, double fontSize) { - if (fontName.isName() && strlen(fontName.getName()) > 0) - appearBuf->appendf("/{0:s} {1:.2f} Tf\n", fontName.getName(), fontSize); -} - void AnnotAppearanceBuilder::setLineStyleForBorder(const AnnotBorder *border) { int i, dashLength; double *dash; @@ -2668,13 +2593,12 @@ void AnnotLink::draw(Gfx *gfx, GBool printing) { //------------------------------------------------------------------------ // AnnotFreeText //------------------------------------------------------------------------ -AnnotFreeText::AnnotFreeText(PDFDoc *docA, PDFRectangle *rect, const DefaultAppearance &da) : +AnnotFreeText::AnnotFreeText(PDFDoc *docA, PDFRectangle *rect, GooString *da) : AnnotMarkup(docA, rect) { type = typeFreeText; - GooString *daStr = da.toAppearanceString(); annotObj.dictSet ("Subtype", Object(objName, "FreeText")); - annotObj.dictSet("DA", Object(daStr)); + annotObj.dictSet("DA", Object(da->copy())); initialize (docA, annotObj.getDict()); } @@ -2802,10 +2726,14 @@ void AnnotFreeText::setContents(GooString *new_content) { invalidateAppearance(); } -void AnnotFreeText::setDefaultAppearance(const DefaultAppearance &da) { +void AnnotFreeText::setAppearanceString(GooString *new_string) { delete appearanceString; - appearanceString = da.toAppearanceString(); + if (new_string) { + appearanceString = new GooString(new_string); + } else { + appearanceString = new GooString(); + } update ("DA", Object(appearanceString->copy())); invalidateAppearance(); @@ -2877,27 +2805,55 @@ void AnnotFreeText::setIntent(AnnotFreeTextIntent new_intent) { update ("IT", Object(objName, intentName)); } -std::unique_ptr AnnotFreeText::getDefaultAppearance() const { - return std::make_unique(appearanceString); -} - -static GfxFont *createAnnotDrawFont(XRef * xref, Dict *fontResDict) +static GfxFont * createAnnotDrawFont(XRef * xref, Dict *fontResDict) { const Ref dummyRef = { -1, -1 }; Dict *fontDict = new Dict(xref); - fontDict->add("BaseFont", Object(objName, "Helvetica")); - fontDict->add("Subtype", Object(objName, "Type0")); - fontDict->add("Encoding", Object(objName, "WinAnsiEncoding")); + fontDict->add(copyString("BaseFont"), Object(objName, "Helvetica")); + fontDict->add(copyString("Subtype"), Object(objName, "Type0")); + fontDict->add(copyString("Encoding"), Object(objName, "WinAnsiEncoding")); Dict *fontsDict = new Dict(xref); - fontsDict->add("AnnotDrawFont", Object(fontDict)); + fontsDict->add(copyString("AnnotDrawFont"), Object(fontDict)); - fontResDict->add("Font", Object(fontsDict)); + fontResDict->add(copyString("Font"), Object(fontsDict)); return GfxFont::makeFont(xref, "AnnotDrawFont", dummyRef, fontDict); } +void AnnotFreeText::parseAppearanceString(GooString *da, double &fontsize, AnnotColor* &fontcolor) { + fontsize = -1; + fontcolor = nullptr; + if (da) { + GooList * daToks = new GooList(); + int i = FormFieldText::tokenizeDA(da, daToks, "Tf"); + + if (i >= 1) { + fontsize = gatof(( (GooString *)daToks->get(i-1) )->getCString()); + // TODO: Font name + } + // Scan backwards: we are looking for the last set value + for (i = daToks->getLength()-1; i >= 0; --i) { + if (fontcolor == nullptr) { + if (!((GooString *)daToks->get(i))->cmp("g") && i >= 1) { + fontcolor = new AnnotColor(gatof(( (GooString *)daToks->get(i-1) )->getCString())); + } else if (!((GooString *)daToks->get(i))->cmp("rg") && i >= 3) { + fontcolor = new AnnotColor(gatof(( (GooString *)daToks->get(i-3) )->getCString()), + gatof(( (GooString *)daToks->get(i-2) )->getCString()), + gatof(( (GooString *)daToks->get(i-1) )->getCString())); + } else if (!((GooString *)daToks->get(i))->cmp("k") && i >= 4) { + fontcolor = new AnnotColor(gatof(( (GooString *)daToks->get(i-4) )->getCString()), + gatof(( (GooString *)daToks->get(i-3) )->getCString()), + gatof(( (GooString *)daToks->get(i-2) )->getCString()), + gatof(( (GooString *)daToks->get(i-1) )->getCString())); + } + } + } + deleteGooList(daToks, GooString); + } +} + void AnnotFreeText::generateFreeTextAppearance() { double borderWidth, ca = opacity; @@ -2914,13 +2870,14 @@ void AnnotFreeText::generateFreeTextAppearance() const double height = rect->y2 - rect->y1; // Parse some properties from the appearance string - DefaultAppearance da{appearanceString}; - + double fontsize; + AnnotColor *fontcolor; + parseAppearanceString(appearanceString, fontsize, fontcolor); // Default values - if (da.getFontPtSize() <= 0) - da.setFontPtSize(10); - if (!da.getFontColor()) - da.setFontColor(std::make_unique(0, 0, 0)); + if (fontsize <= 0) + fontsize = 10; + if (fontcolor == nullptr) + fontcolor = new AnnotColor(0, 0, 0); // Black if (!contents) contents = new GooString (); @@ -2929,7 +2886,7 @@ void AnnotFreeText::generateFreeTextAppearance() GBool doStroke = (borderWidth != 0); if (doFill || doStroke) { if (doStroke) { - appearBuilder.setDrawColor(da.getFontColor(), gFalse); // Border color: same as font color + appearBuilder.setDrawColor(fontcolor, gFalse); // Border color: same as font color } appearBuilder.appendf ("{0:.2f} {0:.2f} {1:.2f} {2:.2f} re\n", borderWidth/2, width-borderWidth, height-borderWidth); if (doFill) { @@ -2949,17 +2906,17 @@ void AnnotFreeText::generateFreeTextAppearance() GfxFont *font = createAnnotDrawFont(xref, fontResDict); // Set font state - appearBuilder.setDrawColor(da.getFontColor(), gTrue); - appearBuilder.appendf ("BT 1 0 0 1 {0:.2f} {1:.2f} Tm\n", textmargin, height - textmargin - da.getFontPtSize() * font->getDescent()); - appearBuilder.appendf ("/AnnotDrawFont {0:.2f} Tf\n", da.getFontPtSize()); + appearBuilder.setDrawColor(fontcolor, gTrue); + appearBuilder.appendf ("BT 1 0 0 1 {0:.2f} {1:.2f} Tm\n", textmargin, height - textmargin - fontsize * font->getDescent()); + appearBuilder.appendf ("/AnnotDrawFont {0:.2f} Tf\n", fontsize); int i = 0; double xposPrev = 0; while (i < contents->getLength()) { GooString out; double linewidth, xpos; - layoutText(contents, &out, &i, font, &linewidth, textwidth/da.getFontPtSize(), nullptr, gFalse); - linewidth *= da.getFontPtSize(); + layoutText(contents, &out, &i, font, &linewidth, textwidth/fontsize, nullptr, gFalse); + linewidth *= fontsize; switch (quadding) { case quaddingCentered: xpos = (textwidth - linewidth) / 2; @@ -2971,13 +2928,14 @@ void AnnotFreeText::generateFreeTextAppearance() xpos = 0; break; } - appearBuilder.appendf("{0:.2f} {1:.2f} Td\n", xpos - xposPrev, -da.getFontPtSize()); + appearBuilder.appendf("{0:.2f} {1:.2f} Td\n", xpos - xposPrev, -fontsize); appearBuilder.writeString(out); appearBuilder.append("Tj\n"); xposPrev = xpos; } font->decRefCnt(); + delete fontcolor; appearBuilder.append ("ET Q\n"); double bbox[4]; @@ -4925,19 +4883,19 @@ void AnnotWidget::generateFieldAppearance(bool *addedDingbatsResource) { const GooString *appearBuf = appearBuilder.buffer(); // build the appearance stream dictionary Dict *appearDict = new Dict(xref); - appearDict->add("Length", Object(appearBuf->getLength())); - appearDict->add("Subtype", Object(objName, "Form")); + appearDict->add(copyString("Length"), Object(appearBuf->getLength())); + appearDict->add(copyString("Subtype"), Object(objName, "Form")); Array *bbox = new Array(xref); bbox->add(Object(0)); bbox->add(Object(0)); bbox->add(Object(rect->x2 - rect->x1)); bbox->add(Object(rect->y2 - rect->y1)); - appearDict->add("BBox", Object(bbox)); + appearDict->add(copyString("BBox"), Object(bbox)); // set the resource dictionary Object *resDict = form->getDefaultResourcesObj(); if (resDict->isDict()) { - appearDict->add("Resources", resDict->copy()); + appearDict->add(copyString("Resources"), resDict->copy()); } // build the appearance stream @@ -4976,7 +4934,7 @@ void AnnotWidget::updateAppearanceStream() // Write the AP dictionary obj1 = Object(new Dict(xref)); - obj1.dictAdd("N", Object(updatedAppearanceStream.num, updatedAppearanceStream.gen)); + obj1.dictAdd(copyString("N"), Object(updatedAppearanceStream.num, updatedAppearanceStream.gen)); // Update our internal pointers to the appearance dictionary appearStreams = new AnnotAppearance(doc, &obj1); @@ -5009,14 +4967,14 @@ void AnnotWidget::draw(Gfx *gfx, GBool printing) { // We are forcing ZaDb but the font does not exist // so create a fake one Dict *fontDict = new Dict(gfx->getXRef()); - fontDict->add("BaseFont", Object(objName, "ZapfDingbats")); - fontDict->add("Subtype", Object(objName, "Type1")); + fontDict->add(copyString("BaseFont"), Object(objName, "ZapfDingbats")); + fontDict->add(copyString("Subtype"), Object(objName, "Type1")); Dict *fontsDict = new Dict(gfx->getXRef()); - fontsDict->add("ZaDb", Object(fontDict)); + fontsDict->add(copyString("ZaDb"), Object(fontDict)); Dict *dict = new Dict(gfx->getXRef()); - dict->add("Font", Object(fontsDict)); + dict->add(copyString("Font"), Object(fontsDict)); gfx->pushResources(dict); delete dict; } diff --git a/Build/source/libs/poppler/poppler-src/poppler/Annot.h b/Build/source/libs/poppler/poppler-src/poppler/Annot.h index d564c413be1..83c10b397b1 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Annot.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Annot.h @@ -27,8 +27,6 @@ // Copyright (C) 2013 Thomas Freitag // Copyright (C) 2013, 2017 Adrian Johnson // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich -// Copyright (C) 2018 Dileep Sankhla -// Copyright (C) 2018 Tobias Deiminger // // 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 @@ -42,7 +40,6 @@ #pragma interface #endif -#include #include "Object.h" class XRef; @@ -350,33 +347,6 @@ private: int length; }; -//------------------------------------------------------------------------ -// DefaultAppearance -//------------------------------------------------------------------------ - -class DefaultAppearance { -public: - - DefaultAppearance(Object &&fontNameA, double fontPtSizeA, std::unique_ptr fontColorA); - DefaultAppearance(GooString *da); - void setFontName(Object &&fontNameA); - const Object &getFontName() const { return fontName; } - void setFontPtSize(double fontPtSizeA); - double getFontPtSize() const { return fontPtSize; } - void setFontColor(std::unique_ptr fontColorA); - const AnnotColor *getFontColor() const { return fontColor.get(); } - GooString *toAppearanceString() const; - - DefaultAppearance(const DefaultAppearance &) = delete; - DefaultAppearance& operator=(const DefaultAppearance&) = delete; - -private: - - Object fontName; - double fontPtSize; - std::unique_ptr fontColor; -}; - //------------------------------------------------------------------------ // AnnotIconFit //------------------------------------------------------------------------ @@ -541,7 +511,6 @@ public: void setDrawColor(const AnnotColor *color, GBool fill); void setLineStyleForBorder(const AnnotBorder *border); - void setTextFont(const Object &fontName, double fontSize); void drawCircle(double cx, double cy, double r, GBool fill); void drawCircleTopLeft(double cx, double cy, double r); void drawCircleBottomRight(double cx, double cy, double r); @@ -1000,7 +969,7 @@ public: intentFreeTextTypeWriter // FreeTextTypeWriter }; - AnnotFreeText(PDFDoc *docA, PDFRectangle *rect, const DefaultAppearance &da); + AnnotFreeText(PDFDoc *docA, PDFRectangle *rect, GooString *da); AnnotFreeText(PDFDoc *docA, Object *dictObject, Object *obj); ~AnnotFreeText(); @@ -1008,14 +977,14 @@ public: Object getAppearanceResDict() override; void setContents(GooString *new_content) override; - void setDefaultAppearance(const DefaultAppearance &da); + void setAppearanceString(GooString *new_string); void setQuadding(AnnotFreeTextQuadding new_quadding); void setStyleString(GooString *new_string); void setCalloutLine(AnnotCalloutLine *line); void setIntent(AnnotFreeTextIntent new_intent); // getters - std::unique_ptr getDefaultAppearance() const; + const GooString *getAppearanceString() const { return appearanceString; } AnnotFreeTextQuadding getQuadding() const { return quadding; } // return rc const GooString *getStyleString() const { return styleString; } @@ -1028,6 +997,7 @@ public: protected: void initialize(PDFDoc *docA, Dict *dict); + static void parseAppearanceString(GooString *da, double &fontsize, AnnotColor* &fontcolor); void generateFreeTextAppearance(); // required diff --git a/Build/source/libs/poppler/poppler-src/poppler/Array.cc b/Build/source/libs/poppler/poppler-src/poppler/Array.cc index f2dc23631f2..e8aa34eafe6 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Array.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Array.cc @@ -18,7 +18,6 @@ // Copyright (C) 2013 Thomas Freitag // Copyright (C) 2013, 2017 Albert Astals Cid // Copyright (C) 2017 Adrian Johnson -// Copyright (C) 2018 Adam Reichold // // 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 @@ -33,7 +32,6 @@ #include #include -#include #include "goo/gmem.h" #include "Object.h" #include "Array.h" @@ -107,8 +105,11 @@ void Array::add(Object &&elem) { void Array::remove(int i) { arrayLocker(); if (i < 0 || i >= length) { - assert(i >= 0 && i < length); +#ifdef DEBUG_MEM + abort(); +#else return; +#endif } --length; memmove( static_cast(elems + i), elems + i + 1, sizeof(elems[0]) * (length - i) ); @@ -116,14 +117,22 @@ void Array::remove(int i) { Object Array::get(int i, int recursion) const { if (i < 0 || i >= length) { +#ifdef DEBUG_MEM + abort(); +#else return Object(objNull); +#endif } return elems[i].fetch(xref, recursion); } Object Array::getNF(int i) const { if (i < 0 || i >= length) { +#ifdef DEBUG_MEM + abort(); +#else return Object(objNull); +#endif } return elems[i].copy(); } diff --git a/Build/source/libs/poppler/poppler-src/poppler/CairoRescaleBox.cc b/Build/source/libs/poppler/poppler-src/poppler/CairoRescaleBox.cc index 59a5c190226..f34b1e1c79c 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/CairoRescaleBox.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/CairoRescaleBox.cc @@ -32,7 +32,6 @@ // // Copyright (C) 2012 Hib Eris // Copyright (C) 2012, 2017 Adrian Johnson -// Copyright (C) 2018 Adam Reichold // // 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 @@ -282,10 +281,10 @@ GBool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height, dest = (unsigned int *)cairo_image_surface_get_data (dest_surface); dst_stride = cairo_image_surface_get_stride (dest_surface); - scanline = (uint32_t*)gmallocn (orig_width, sizeof(int)); + scanline = (uint32_t*)gmallocn3 (orig_width, 1, sizeof(int)); - x_coverage = (int *)gmallocn (orig_width, sizeof(int)); - y_coverage = (int *)gmallocn (orig_height, sizeof(int)); + x_coverage = (int *)gmallocn3 (orig_width, 1, sizeof(int)); + y_coverage = (int *)gmallocn3 (orig_height, 1, sizeof(int)); /* we need to allocate enough room for ceil(src_height/dest_height)+1 Example: diff --git a/Build/source/libs/poppler/poppler-src/poppler/Catalog.cc b/Build/source/libs/poppler/poppler-src/poppler/Catalog.cc index 55b7528b450..e6fde7ab34d 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Catalog.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Catalog.cc @@ -34,7 +34,6 @@ // Copyright (C) 2015 Even Rouault // Copyright (C) 2016 Masamichi Hosoda // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich -// Copyright (C) 2018 Adam Reichold // // 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 @@ -429,7 +428,7 @@ int Catalog::numDests() return obj->dictGetLength(); } -const char *Catalog::getDestsName(int i) +char *Catalog::getDestsName(int i) { Object *obj; diff --git a/Build/source/libs/poppler/poppler-src/poppler/Catalog.h b/Build/source/libs/poppler/poppler-src/poppler/Catalog.h index 5c8c50704b7..0467159a2d4 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Catalog.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Catalog.h @@ -27,7 +27,6 @@ // Copyright (C) 2013 José Aliste // Copyright (C) 2016 Masamichi Hosoda // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich -// Copyright (C) 2018 Adam Reichold // // 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 @@ -164,7 +163,7 @@ public: int numDests(); // Get the i'th named destination name in name-dict - const char *getDestsName(int i); + char *getDestsName(int i); // Get the i'th named destination link destination in name-dict LinkDest *getDestsDest(int i); diff --git a/Build/source/libs/poppler/poppler-src/poppler/Dict.cc b/Build/source/libs/poppler/poppler-src/poppler/Dict.cc index 0a0ceab3f01..bc86fd77ad9 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Dict.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Dict.cc @@ -22,7 +22,6 @@ // Copyright (C) 2013 Thomas Freitag // Copyright (C) 2014 Scott West // Copyright (C) 2017 Adrian Johnson -// Copyright (C) 2018 Adam Reichold // // 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 @@ -36,7 +35,10 @@ #endif #include - +#include +#include +#include "goo/gmem.h" +#include "Object.h" #include "XRef.h" #include "Dict.h" @@ -49,164 +51,247 @@ // Dict //------------------------------------------------------------------------ -constexpr int SORT_LENGTH_LOWER_LIMIT = 32; +static const int SORT_LENGTH_LOWER_LIMIT = 32; -struct Dict::CmpDictEntry { - bool operator()(const DictEntry &lhs, const DictEntry &rhs) const { - return lhs.first < rhs.first; - } - bool operator()(const DictEntry &lhs, const char *rhs) const { - return lhs.first < rhs; - } - bool operator()(const char *lhs, const DictEntry &rhs) const { - return lhs < rhs.first; +static inline bool cmpDictEntries(const DictEntry &e1, const DictEntry &e2) +{ + return strcmp(e1.key, e2.key) < 0; +} + +static int binarySearch(const char *key, DictEntry *entries, int length) +{ + int first = 0; + int end = length - 1; + while (first <= end) { + const int middle = (first + end) / 2; + const int res = strcmp(key, entries[middle].key); + if (res == 0) { + return middle; + } else if (res < 0) { + end = middle - 1; + } else { + first = middle + 1; + } } -}; + return -1; +} Dict::Dict(XRef *xrefA) { xref = xrefA; + entries = nullptr; + size = length = 0; ref = 1; + sorted = gFalse; #ifdef MULTITHREADED gInitMutex(&mutex); #endif - - sorted = false; } -Dict::Dict(const Dict* dictA) { +Dict::Dict(Dict* dictA) { xref = dictA->xref; + size = length = dictA->length; ref = 1; #ifdef MULTITHREADED gInitMutex(&mutex); #endif - entries.reserve(dictA->entries.size()); - for (const auto& entry : dictA->entries) { - entries.emplace_back(entry.first, entry.second.copy()); + sorted = dictA->sorted; + entries = (DictEntry *)gmallocn(size, sizeof(DictEntry)); + for (int i=0; ientries[i].key); + entries[i].val.initNullAfterMalloc(); + entries[i].val = dictA->entries[i].val.copy(); } - - sorted = dictA->sorted.load(); } -Dict *Dict::copy(XRef *xrefA) const { +Dict *Dict::copy(XRef *xrefA) { dictLocker(); Dict *dictA = new Dict(this); dictA->xref = xrefA; - for (auto &entry : dictA->entries) { - if (entry.second.getType() == objDict) { - entry.second = Object(entry.second.getDict()->copy(xrefA)); + for (int i=0; ientries[i].val.getType() == objDict) { + Dict *copy = dictA->entries[i].val.getDict()->copy(xrefA); + dictA->entries[i].val = Object(copy); } } return dictA; } Dict::~Dict() { + int i; + + for (i = 0; i < length; ++i) { + gfree(entries[i].key); + entries[i].val.free(); + } + gfree(entries); #ifdef MULTITHREADED gDestroyMutex(&mutex); #endif } -void Dict::add(const char *key, Object &&val) { +int Dict::incRef() { dictLocker(); - entries.emplace_back(key, std::move(val)); - sorted = false; + ++ref; + return ref; } -inline const Dict::DictEntry *Dict::find(const char *key) const { - if (entries.size() >= SORT_LENGTH_LOWER_LIMIT) { - if (!sorted) { - dictLocker(); - if (!sorted) { - auto& entries = const_cast&>(this->entries); - auto& sorted = const_cast(this->sorted); +int Dict::decRef() { + dictLocker(); + --ref; + return ref; +} - std::sort(entries.begin(), entries.end(), CmpDictEntry{}); - sorted = true; - } +void Dict::add(char *key, Object &&val) { + dictLocker(); + if (sorted) { + // We use add on very few occasions so + // virtually this will never be hit + sorted = gFalse; + } + + if (length == size) { + if (length == 0) { + size = 8; + } else { + size *= 2; } + entries = (DictEntry *)greallocn(entries, size, sizeof(DictEntry)); + } + entries[length].key = key; + entries[length].val.initNullAfterMalloc(); + entries[length].val = std::move(val); + ++length; +} + +inline DictEntry *Dict::find(const char *key) const { + if (!sorted && length >= SORT_LENGTH_LOWER_LIMIT) + { + dictLocker(); + sorted = gTrue; + std::sort(entries, entries+length, cmpDictEntries); } if (sorted) { - const auto pos = std::lower_bound(entries.begin(), entries.end(), key, CmpDictEntry{}); - if (pos != entries.end() && pos->first == key) { - return &*pos; + const int pos = binarySearch(key, entries, length); + if (pos != -1) { + return &entries[pos]; } } else { - const auto pos = std::find_if(entries.rbegin(), entries.rend(), [key](const DictEntry& entry) { - return entry.first == key; - }); - if (pos != entries.rend()) { - return &*pos; + int i; + + for (i = length - 1; i >=0; --i) { + if (!strcmp(key, entries[i].key)) + return &entries[i]; } } return nullptr; } -inline Dict::DictEntry *Dict::find(const char *key) { - return const_cast(const_cast(this)->find(key)); +GBool Dict::hasKey(const char *key) const { + return find(key) != nullptr; } void Dict::remove(const char *key) { dictLocker(); - if (auto *entry = find(key)) { - if (sorted) { - const auto index = entry - &entries.front(); - entries.erase(entries.begin() + index); - } else { - swap(*entry, entries.back()); - entries.pop_back(); + if (sorted) { + const int pos = binarySearch(key, entries, length); + if (pos != -1) { + length -= 1; + gfree(entries[pos].key); + entries[pos].val.free(); + if (pos != length) { + memmove(static_cast(&entries[pos]), &entries[pos + 1], (length - pos) * sizeof(DictEntry)); + } + } + } else { + int i; + bool found = false; + if(length == 0) { + return; + } + + for(i=0; isecond = std::move(val); + e = find (key); + if (e) { + dictLocker(); + e->val = std::move(val); } else { - add(key, std::move(val)); + add (copyString(key), std::move(val)); } } GBool Dict::is(const char *type) const { - if (const auto *entry = find("Type")) { - return entry->second.isName(type); - } - return gFalse; + DictEntry *e; + + return (e = find("Type")) && e->val.isName(type); } Object Dict::lookup(const char *key, int recursion) const { - if (const auto *entry = find(key)) { - return entry->second.fetch(xref, recursion); - } - return Object(objNull); + DictEntry *e; + + return (e = find(key)) ? e->val.fetch(xref, recursion) : Object(objNull); } Object Dict::lookupNF(const char *key) const { - if (const auto *entry = find(key)) { - return entry->second.copy(); - } - return Object(objNull); + DictEntry *e; + + return (e = find(key)) ? e->val.copy() : Object(objNull); } GBool Dict::lookupInt(const char *key, const char *alt_key, int *value) const { - auto obj1 = lookup(key); - if (obj1.isNull() && alt_key != nullptr) { - obj1 = lookup(alt_key); + GBool success = gFalse; + Object obj1 = lookup ((char *) key); + if (obj1.isNull () && alt_key != nullptr) { + obj1.free (); + obj1 = lookup ((char *) alt_key); } - if (obj1.isInt()) { - *value = obj1.getInt(); - return gTrue; + if (obj1.isInt ()) { + *value = obj1.getInt (); + success = gTrue; } - return gFalse; + + obj1.free (); + + return success; } -GBool Dict::hasKey(const char *key) const { - return find(key) != nullptr; +char *Dict::getKey(int i) const { + return entries[i].key; +} + +Object Dict::getVal(int i) const { + return entries[i].val.fetch(xref); +} + +Object Dict::getValNF(int i) const { + return entries[i].val.copy(); } diff --git a/Build/source/libs/poppler/poppler-src/poppler/Dict.h b/Build/source/libs/poppler/poppler-src/poppler/Dict.h index a4fd1c56138..9fd732a1561 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Dict.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Dict.h @@ -20,7 +20,6 @@ // Copyright (C) 2010 PaweÅ‚ Wiejacha // Copyright (C) 2013 Thomas Freitag // Copyright (C) 2017 Adrian Johnson -// Copyright (C) 2018 Adam Reichold // // 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 @@ -34,11 +33,6 @@ #pragma interface #endif -#include -#include -#include -#include - #include "poppler-config.h" #include "Object.h" #include "goo/GooMutex.h" @@ -47,13 +41,18 @@ // Dict //------------------------------------------------------------------------ +struct DictEntry { + char *key; + Object val; +}; + class Dict { public: // Constructor. Dict(XRef *xrefA); - Dict(const Dict *dictA); - Dict *copy(XRef *xrefA) const; + Dict(Dict* dictA); + Dict *copy(XRef *xrefA); // Destructor. ~Dict(); @@ -62,14 +61,11 @@ public: Dict& operator=(const Dict &) = delete; // Get number of entries. - int getLength() const { return static_cast(entries.size()); } + int getLength() const { return length; } - // Add an entry. (Copies key into Dict.) + // Add an entry. NB: does not copy key. // val becomes a dead object after the call - void add(const char *key, Object &&val); - - // Add an entry. (Takes ownership of key.) - void add(char *key, Object &&val) = delete; + void add(char *key, Object &&val); // Update the value of an existing entry, otherwise create it // val becomes a dead object after the call @@ -87,9 +83,9 @@ public: GBool lookupInt(const char *key, const char *alt_key, int *value) const; // Iterative accessors. - const char *getKey(int i) const { return entries[i].first.c_str(); } - Object getVal(int i) const { return entries[i].second.fetch(xref); } - Object getValNF(int i) const { return entries[i].second.copy(); } + char *getKey(int i) const; + Object getVal(int i) const; + Object getValNF(int i) const; // Set the xref pointer. This is only used in one special case: the // trailer dictionary, which is read before the xref table is @@ -104,22 +100,20 @@ private: friend class Object; // for incRef/decRef // Reference counting. - int incRef() { return ++ref; } - int decRef() { return --ref; } - - using DictEntry = std::pair; - struct CmpDictEntry; + int incRef(); + int decRef(); - std::atomic_bool sorted; + mutable GBool sorted; XRef *xref; // the xref table for this PDF file - std::vector entries; - std::atomic_int ref; // reference count + DictEntry *entries; // array of entries + int size; // size of array + int length; // number of entries in dictionary + int ref; // reference count #ifdef MULTITHREADED mutable GooMutex mutex; #endif - const DictEntry *find(const char *key) const; - DictEntry *find(const char *key); + DictEntry *find(const char *key) const; }; #endif diff --git a/Build/source/libs/poppler/poppler-src/poppler/Form.cc b/Build/source/libs/poppler/poppler-src/poppler/Form.cc index 2ff4aafa844..3f2ab9a10bf 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Form.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Form.cc @@ -5,7 +5,7 @@ // This file is licensed under the GPLv2 or later // // Copyright 2006-2008 Julien Rebetez -// Copyright 2007-2012, 2015-2018 Albert Astals Cid +// Copyright 2007-2012, 2015-2017 Albert Astals Cid // Copyright 2007-2008, 2011 Carlos Garcia Campos // Copyright 2007, 2013, 2016 Adrian Johnson // Copyright 2007 Iñigo Martínez @@ -22,7 +22,6 @@ // Copyright 2018 Andre Heinecke // Copyright 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich // Copyright 2018 Chinmoy Ranjan Pradhan -// Copyright 2018 Adam Reichold // //======================================================================== @@ -194,7 +193,7 @@ FormWidgetButton::FormWidgetButton (PDFDoc *docA, Object *aobj, unsigned num, Re Object obj2 = obj1.dictLookup("N"); if (obj2.isDict()) { for (int i = 0; i < obj2.dictGetLength(); i++) { - const char *key = obj2.dictGetKey(i); + char *key = obj2.dictGetKey(i); if (strcmp (key, "Off") != 0) { onStr = new GooString (key); break; @@ -1638,12 +1637,12 @@ void FormFieldSignature::parseInfo() const Object location_obj = sig_dict.dictLookup("Location"); if (location_obj.isString()) { - signature_info->setLocation(location_obj.getString()->getCString()); + signature_info->setLocation(location_obj.getString()->copy()->getCString()); } const Object reason_obj = sig_dict.dictLookup("Reason"); if (reason_obj.isString()) { - signature_info->setReason(reason_obj.getString()->getCString()); + signature_info->setReason(reason_obj.getString()->copy()->getCString()); } // retrieve SigningTime diff --git a/Build/source/libs/poppler/poppler-src/poppler/Function.cc b/Build/source/libs/poppler/poppler-src/poppler/Function.cc index 6918fbcda9e..cc32414b87b 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Function.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Function.cc @@ -362,11 +362,7 @@ SampledFunction::SampledFunction(Object *funcObj, Dict *dict) { nSamples = n; for (i = 0; i < m; ++i) nSamples *= sampleSize[i]; - samples = (double *)gmallocn_checkoverflow(nSamples, sizeof(double)); - if (!samples) { - error(errSyntaxError, -1, "Function has invalid number of samples"); - return; - } + samples = (double *)gmallocn(nSamples, sizeof(double)); buf = 0; bits = 0; bitMask = (1 << sampleBits) - 1; diff --git a/Build/source/libs/poppler/poppler-src/poppler/Gfx.cc b/Build/source/libs/poppler/poppler-src/poppler/Gfx.cc index 5b3b8f122a2..8f2c62d24a7 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Gfx.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Gfx.cc @@ -40,7 +40,6 @@ // Copyright (C) 2014 Jason Crain // Copyright (C) 2017, 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich // Copyright (C) 2018 Adam Reichold -// Copyright (C) 2018 Denis Onishchenko // // 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 @@ -3885,15 +3884,15 @@ void Gfx::doShowText(const GooString *s) { double x, y, dx, dy, dx2, dy2, curX, curY, tdx, tdy, ddx, ddy; double originX, originY, tOriginX, tOriginY; double x0, y0, x1, y1; - double tmp[4], newCTM[6]; - double *oldCTM, *mat; + double oldCTM[6], newCTM[6]; + double *mat; Dict *resDict; Parser *oldParser; GfxState *savedState; const char *p; int render; GBool patternFill; - int len, n, uLen, nChars, nSpaces; + int len, n, uLen, nChars, nSpaces, i; font = state->getFont(); wMode = font->getWMode(); @@ -3926,23 +3925,26 @@ void Gfx::doShowText(const GooString *s) { // handle a Type 3 char if (font->getType() == fontType3 && out->interpretType3Chars()) { - oldCTM = state->getCTM(); + mat = state->getCTM(); + for (i = 0; i < 6; ++i) { + oldCTM[i] = mat[i]; + } mat = state->getTextMat(); - tmp[0] = mat[0] * oldCTM[0] + mat[1] * oldCTM[2]; - tmp[1] = mat[0] * oldCTM[1] + mat[1] * oldCTM[3]; - tmp[2] = mat[2] * oldCTM[0] + mat[3] * oldCTM[2]; - tmp[3] = mat[2] * oldCTM[1] + mat[3] * oldCTM[3]; + newCTM[0] = mat[0] * oldCTM[0] + mat[1] * oldCTM[2]; + newCTM[1] = mat[0] * oldCTM[1] + mat[1] * oldCTM[3]; + newCTM[2] = mat[2] * oldCTM[0] + mat[3] * oldCTM[2]; + newCTM[3] = mat[2] * oldCTM[1] + mat[3] * oldCTM[3]; mat = font->getFontMatrix(); - newCTM[0] = mat[0] * tmp[0] + mat[1] * tmp[2]; - newCTM[1] = mat[0] * tmp[1] + mat[1] * tmp[3]; - newCTM[2] = mat[2] * tmp[0] + mat[3] * tmp[2]; - newCTM[3] = mat[2] * tmp[1] + mat[3] * tmp[3]; + newCTM[0] = mat[0] * newCTM[0] + mat[1] * newCTM[2]; + newCTM[1] = mat[0] * newCTM[1] + mat[1] * newCTM[3]; + newCTM[2] = mat[2] * newCTM[0] + mat[3] * newCTM[2]; + newCTM[3] = mat[2] * newCTM[1] + mat[3] * newCTM[3]; newCTM[0] *= state->getFontSize(); newCTM[1] *= state->getFontSize(); newCTM[2] *= state->getFontSize(); newCTM[3] *= state->getFontSize(); newCTM[0] *= state->getHorizScaling(); - newCTM[1] *= state->getHorizScaling(); + newCTM[2] *= state->getHorizScaling(); curX = state->getCurX(); curY = state->getCurY(); oldParser = parser; @@ -4212,7 +4214,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { GBool invert; GfxColorSpace *colorSpace, *maskColorSpace; GBool haveColorKeyMask, haveExplicitMask, haveSoftMask; - int maskColors[2*gfxColorMaxComps] = {}; + int maskColors[2*gfxColorMaxComps]; int maskWidth, maskHeight; GBool maskInvert; GBool maskInterpolate; @@ -4910,6 +4912,7 @@ void Gfx::opBeginImage(Object args[], int numArgs) { } Stream *Gfx::buildImageStream() { + char *key; Stream *str; // build dictionary @@ -4919,11 +4922,13 @@ Stream *Gfx::buildImageStream() { if (!obj.isName()) { error(errSyntaxError, getPos(), "Inline image dictionary key must be a name object"); } else { - auto val = parser->getObj(); - if (val.isEOF() || val.isError()) { + key = copyString(obj.getName()); + obj = parser->getObj(); + if (obj.isEOF() || obj.isError()) { + gfree(key); break; } - dict.dictAdd(obj.getName(), std::move(val)); + dict.dictAdd(key, std::move(obj)); } obj = parser->getObj(); } diff --git a/Build/source/libs/poppler/poppler-src/poppler/GfxFont.cc b/Build/source/libs/poppler/poppler-src/poppler/GfxFont.cc index 662c9a49412..7b4d4b5487a 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/GfxFont.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/GfxFont.cc @@ -33,7 +33,6 @@ // Copyright (C) 2013-2016, 2018 Jason Crain // Copyright (C) 2014 Olly Betts // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich -// Copyright (C) 2018 Adam Reichold // // 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 @@ -1440,7 +1439,7 @@ static int parseCharName(char *charName, Unicode *uBuf, int uLen, return 0; // .notdef or similar } else if (var_part != nullptr) { // parse names of the form 7.oldstyle, P.swash, s.sc, etc. - char *main_part = copyString(charName, var_part - charName); + char *main_part = gstrndup(charName, var_part - charName); GBool namesRecurse = gTrue, variantsRecurse = gFalse; int n = parseCharName(main_part, uBuf, uLen, namesRecurse, ligatures, numeric, hex, variantsRecurse); diff --git a/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc b/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc index b8423f23fc2..956a214bf84 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc @@ -31,8 +31,6 @@ // Copyright (C) 2016 Marek Kasik // Copyright (C) 2017 Oliver Sander // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich -// Copyright (C) 2018 Volker Krause -// Copyright (C) 2018 Adam Reichold // // 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 @@ -4008,9 +4006,7 @@ void GfxUnivariateShading::setupCache(const Matrix *ctm, tMax = t0 + sMin * (t1 - t0); } - cacheBounds = (double *)gmallocn_checkoverflow(maxSize, sizeof(double) * (nComps + 2)); - if (unlikely(!cacheBounds)) - return; + cacheBounds = (double *)gmallocn(maxSize, sizeof(double) * (nComps + 2)); cacheCoeff = cacheBounds + maxSize; cacheValues = cacheCoeff + maxSize; @@ -5228,7 +5224,7 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di nPatchesA = 0; patchesA = nullptr; patchesSize = 0; - auto bitBuf = std::make_unique(str); + std::unique_ptr bitBuf(new GfxShadingBitBuf(str)); while (1) { if (!bitBuf->getBits(flagBits, &flag)) { break; @@ -5872,30 +5868,24 @@ GfxImageColorMap::GfxImageColorMap(GfxImageColorMap *colorMap) { colorSpace2 = nullptr; for (k = 0; k < gfxColorMaxComps; ++k) { lookup[k] = nullptr; - lookup2[k] = nullptr; } - byte_lookup = nullptr; n = 1 << bits; - for (k = 0; k < nComps; ++k) { - lookup[k] = (GfxColorComp *)gmallocn(n, sizeof(GfxColorComp)); - memcpy(lookup[k], colorMap->lookup[k], n * sizeof(GfxColorComp)); - } if (colorSpace->getMode() == csIndexed) { colorSpace2 = ((GfxIndexedColorSpace *)colorSpace)->getBase(); for (k = 0; k < nComps2; ++k) { - lookup2[k] = (GfxColorComp *)gmallocn(n, sizeof(GfxColorComp)); - memcpy(lookup2[k], colorMap->lookup2[k], n * sizeof(GfxColorComp)); + lookup[k] = (GfxColorComp *)gmallocn(n, sizeof(GfxColorComp)); + memcpy(lookup[k], colorMap->lookup[k], n * sizeof(GfxColorComp)); } } else if (colorSpace->getMode() == csSeparation) { colorSpace2 = ((GfxSeparationColorSpace *)colorSpace)->getAlt(); for (k = 0; k < nComps2; ++k) { - lookup2[k] = (GfxColorComp *)gmallocn(n, sizeof(GfxColorComp)); - memcpy(lookup2[k], colorMap->lookup2[k], n * sizeof(GfxColorComp)); + lookup[k] = (GfxColorComp *)gmallocn(n, sizeof(GfxColorComp)); + memcpy(lookup[k], colorMap->lookup[k], n * sizeof(GfxColorComp)); } } else { for (k = 0; k < nComps; ++k) { - lookup2[k] = (GfxColorComp *)gmallocn(n, sizeof(GfxColorComp)); - memcpy(lookup2[k], colorMap->lookup2[k], n * sizeof(GfxColorComp)); + lookup[k] = (GfxColorComp *)gmallocn(n, sizeof(GfxColorComp)); + memcpy(lookup[k], colorMap->lookup[k], n * sizeof(GfxColorComp)); } } if (colorMap->byte_lookup) { diff --git a/Build/source/libs/poppler/poppler-src/poppler/GlobalParams.cc b/Build/source/libs/poppler/poppler-src/poppler/GlobalParams.cc index c1131df34b7..6d8941ea3bc 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/GlobalParams.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/GlobalParams.cc @@ -68,7 +68,6 @@ #include "goo/GooString.h" #include "goo/GooList.h" #include "goo/gfile.h" -#include "goo/gdir.h" #include "Error.h" #include "NameToCharCode.h" #include "CharCodeToUnicode.h" diff --git a/Build/source/libs/poppler/poppler-src/poppler/JBIG2Stream.cc b/Build/source/libs/poppler/poppler-src/poppler/JBIG2Stream.cc index 2acbc915a15..25df3db8ae0 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/JBIG2Stream.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/JBIG2Stream.cc @@ -23,7 +23,6 @@ // Copyright (C) 2013 Adrian Johnson // Copyright (C) 2013, 2014 Fabio D'Urso // Copyright (C) 2015 Suzuki Toshiya -// Copyright (C) 2018 Adam Reichold // // 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 @@ -2967,19 +2966,17 @@ JBIG2Bitmap *JBIG2Stream::readGenericBitmap(GBool mmr, int w, int h, if (mmr) { mmrDecoder->reset(); - // 0 <= codingLine[0] < codingLine[1] < ... < codingLine[n] = w - // ---> max codingLine size = w + 1 - // refLine has one extra guard entry at the end - // ---> max refLine size = w + 2 - codingLine = (int *)gmallocn_checkoverflow(w + 1, sizeof(int)); - refLine = (int *)gmallocn_checkoverflow(w + 2, sizeof(int)); - - if (unlikely(!codingLine || !refLine)) { + if (w > INT_MAX - 2) { error(errSyntaxError, curStr->getPos(), "Bad width in JBIG2 generic bitmap"); delete bitmap; return nullptr; } - + // 0 <= codingLine[0] < codingLine[1] < ... < codingLine[n] = w + // ---> max codingLine size = w + 1 + // refLine has one extra guard entry at the end + // ---> max refLine size = w + 2 + codingLine = (int *)gmallocn(w + 1, sizeof(int)); + refLine = (int *)gmallocn(w + 2, sizeof(int)); memset(refLine, 0, (w + 2) * sizeof(int)); for (i = 0; i < w + 1; ++i) codingLine[i] = w; @@ -4088,20 +4085,15 @@ void JBIG2Stream::readCodeTableSeg(Guint segNum, Guint length) { huffDecoder->reset(); huffTabSize = 8; - huffTab = (JBIG2HuffmanTable *)gmallocn_checkoverflow(huffTabSize, sizeof(JBIG2HuffmanTable)); - if (unlikely(!huffTab)) { - goto oomError; - } - + huffTab = (JBIG2HuffmanTable *) + gmallocn(huffTabSize, sizeof(JBIG2HuffmanTable)); i = 0; val = lowVal; while (val < highVal) { if (i == huffTabSize) { huffTabSize *= 2; - huffTab = (JBIG2HuffmanTable *)greallocn_checkoverflow(huffTab, huffTabSize, sizeof(JBIG2HuffmanTable)); - if (unlikely(!huffTab)) { - goto oomError; - } + huffTab = (JBIG2HuffmanTable *) + greallocn(huffTab, huffTabSize, sizeof(JBIG2HuffmanTable)); } huffTab[i].val = val; huffTab[i].prefixLen = huffDecoder->readBits(prefixBits); @@ -4111,10 +4103,8 @@ void JBIG2Stream::readCodeTableSeg(Guint segNum, Guint length) { } if (i + oob + 3 > huffTabSize) { huffTabSize = i + oob + 3; - huffTab = (JBIG2HuffmanTable *)greallocn_checkoverflow(huffTab, huffTabSize, sizeof(JBIG2HuffmanTable)); - if (unlikely(!huffTab)) { - goto oomError; - } + huffTab = (JBIG2HuffmanTable *) + greallocn(huffTab, huffTabSize, sizeof(JBIG2HuffmanTable)); } huffTab[i].val = lowVal - 1; huffTab[i].prefixLen = huffDecoder->readBits(prefixBits); @@ -4142,8 +4132,6 @@ void JBIG2Stream::readCodeTableSeg(Guint segNum, Guint length) { eofError: error(errSyntaxError, curStr->getPos(), "Unexpected EOF in JBIG2 stream"); - oomError: - error(errInternal, curStr->getPos(), "Failed allocation when processing JBIG2 stream"); } void JBIG2Stream::readExtensionSeg(Guint length) { diff --git a/Build/source/libs/poppler/poppler-src/poppler/Link.cc b/Build/source/libs/poppler/poppler-src/poppler/Link.cc index f88183f9d9e..4a20752c1d4 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Link.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Link.cc @@ -56,8 +56,7 @@ LinkAction::LinkAction() : nextActionList(nullptr) { } LinkAction::~LinkAction() { - if (nextActionList) - deleteGooList(nextActionList, LinkAction); + delete nextActionList; } LinkAction *LinkAction::parseDest(const Object *obj) { diff --git a/Build/source/libs/poppler/poppler-src/poppler/Object.cc b/Build/source/libs/poppler/poppler-src/poppler/Object.cc index 9112d31681f..d3adc4473ab 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Object.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Object.cc @@ -15,7 +15,6 @@ // // Copyright (C) 2008, 2010, 2012, 2017 Albert Astals Cid // Copyright (C) 2013 Adrian Johnson -// Copyright (C) 2018 Adam Reichold // // 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 @@ -59,6 +58,11 @@ static const char *objTypeNames[numObjTypes] = { "dead" }; +#ifdef DEBUG_MEM +int Object::numAlloc[numObjTypes] = + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +#endif + Object::Object(Object&& other) { type = other.type; @@ -91,7 +95,6 @@ Object Object::copy() const { obj.string = string->copy(); break; case objName: - case objCmd: obj.cString = copyString(cString); break; case objArray: @@ -103,9 +106,15 @@ Object Object::copy() const { case objStream: stream->incRef(); break; + case objCmd: + obj.cString = copyString(cString); + break; default: break; } +#ifdef DEBUG_MEM + ++numAlloc[type]; +#endif return obj; } @@ -122,7 +131,6 @@ void Object::free() { delete string; break; case objName: - case objCmd: gfree(cString); break; case objArray: @@ -140,9 +148,15 @@ void Object::free() { delete stream; } break; + case objCmd: + gfree(cString); + break; default: break; } +#ifdef DEBUG_MEM + --numAlloc[type]; +#endif type = objNone; } @@ -220,3 +234,23 @@ void Object::print(FILE *f) const { break; } } + +void Object::memCheck(FILE *f) { +#ifdef DEBUG_MEM + int i; + int t; + + t = 0; + for (i = 0; i < numObjTypes; ++i) + t += numAlloc[i]; + if (t > 0) { + fprintf(f, "Allocated objects:\n"); + for (i = 0; i < numObjTypes; ++i) { + if (numAlloc[i] > 0) + fprintf(f, " %-20s: %6d\n", objTypeNames[i], numAlloc[i]); + } + } +#else + (void)f; +#endif +} diff --git a/Build/source/libs/poppler/poppler-src/poppler/Object.h b/Build/source/libs/poppler/poppler-src/poppler/Object.h index 3dcf9e6bbf7..97978f46528 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Object.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Object.h @@ -15,7 +15,7 @@ // // Copyright (C) 2007 Julien Rebetez // Copyright (C) 2008 Kees Cook -// Copyright (C) 2008, 2010, 2017, 2018 Albert Astals Cid +// Copyright (C) 2008, 2010, 2017 Albert Astals Cid // Copyright (C) 2009 Jakub Wilk // Copyright (C) 2012 Fabio D'Urso // Copyright (C) 2013 Thomas Freitag @@ -23,7 +23,6 @@ // Copyright (C) 2013 Adrian Perez de Castro // Copyright (C) 2016 Jakub Alba // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich -// Copyright (C) 2018 Adam Reichold // // 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 @@ -37,7 +36,6 @@ #pragma interface #endif -#include #include #include #include @@ -89,33 +87,14 @@ struct Ref { int gen; // generation number }; -inline bool operator== (const Ref& lhs, const Ref& rhs) noexcept { - return lhs.num == rhs.num && lhs.gen == rhs.gen; -} - -inline bool operator< (const Ref& lhs, const Ref& rhs) noexcept { - if (lhs.num != rhs.num) - return lhs.num < rhs.num; - return lhs.gen < rhs.gen; -} - -namespace std -{ - -template<> -struct hash -{ - using argument_type = Ref; - using result_type = size_t; - - result_type operator() (const argument_type &ref) const noexcept - { - return std::hash{}(ref.num) ^ (std::hash{}(ref.gen) << 1); - } +struct RefCompare { + bool operator() (const Ref& lhs, const Ref& rhs) const { + if (lhs.num != rhs.num) + return lhs.num < rhs.num; + return lhs.gen < rhs.gen; + } }; -} - //------------------------------------------------------------------------ // object types //------------------------------------------------------------------------ @@ -152,8 +131,17 @@ enum ObjType { // Object //------------------------------------------------------------------------ +#ifdef DEBUG_MEM +#define initObj(t) free(); zeroUnion(); ++numAlloc[type = t] +#else #define initObj(t) free(); zeroUnion(); type = t +#endif + +#ifdef DEBUG_MEM +#define constructObj(t) ++numAlloc[type = t] +#else #define constructObj(t) type = t +#endif class Object { public: @@ -174,17 +162,17 @@ public: explicit Object(double realA) { constructObj(objReal); real = realA; } explicit Object(GooString *stringA) - { assert(stringA); constructObj(objString); string = stringA; } + { constructObj(objString); string = stringA; } Object(ObjType typeA, const char *stringA) - { assert(typeA == objName || typeA == objCmd); assert(stringA); constructObj(typeA); cString = copyString(stringA); } + { constructObj(typeA); cString = copyString(stringA); } explicit Object(long long int64gA) { constructObj(objInt64); int64g = int64gA; } explicit Object(Array *arrayA) - { assert(arrayA); constructObj(objArray); array = arrayA; } + { constructObj(objArray); array = arrayA; } explicit Object(Dict *dictA) - { assert(dictA); constructObj(objDict); dict = dictA; } + { constructObj(objDict); dict = dictA; } explicit Object(Stream *streamA) - { assert(streamA); constructObj(objStream); stream = streamA; } + { constructObj(objStream); stream = streamA; } Object(int numA, int genA) { constructObj(objRef); ref.num = numA; ref.gen = genA; } template Object(T) = delete; @@ -250,8 +238,10 @@ public: return type == objInt ? (double)intg : type == objInt64 ? (double)int64g : real; } const GooString *getString() const { OBJECT_TYPE_CHECK(objString); return string; } - // After takeString() the only method that should be called for the object is free(). - GooString *takeString() { OBJECT_TYPE_CHECK(objString); type = objDead; return string; } + // After takeString() the only method that should be called for the object is free() + // because the object it's not expected to have a NULL string. + GooString *takeString() { + OBJECT_TYPE_CHECK(objString); GooString *s = string; string = nullptr; return s; } const char *getName() const { OBJECT_TYPE_CHECK(objName); return cString; } Array *getArray() const { OBJECT_TYPE_CHECK(objArray); return array; } Dict *getDict() const { OBJECT_TYPE_CHECK(objDict); return dict; } @@ -273,14 +263,13 @@ public: // Dict accessors. int dictGetLength() const; - void dictAdd(char *key, Object &&val) = delete; - void dictAdd(const char *key, Object &&val); + void dictAdd(char *key, Object &&val); void dictSet(const char *key, Object &&val); void dictRemove(const char *key); GBool dictIs(const char *dictType) const; Object dictLookup(const char *key, int recursion = 0) const; Object dictLookupNF(const char *key) const; - const char *dictGetKey(int i) const; + char *dictGetKey(int i) const; Object dictGetVal(int i) const; Object dictGetValNF(int i) const; @@ -300,6 +289,9 @@ public: const char *getTypeName() const; void print(FILE *f = stdout) const; + // Memory testing. + static void memCheck(FILE *f); + private: friend class Array; // Needs free and initNullAfterMalloc friend class Dict; // Needs free and initNullAfterMalloc @@ -324,6 +316,11 @@ private: Stream *stream; // stream Ref ref; // indirect reference }; + +#ifdef DEBUG_MEM + static int // number of each type of object + numAlloc[numObjTypes]; // currently allocated +#endif }; //------------------------------------------------------------------------ @@ -356,7 +353,7 @@ inline Object Object::arrayGetNF(int i) const inline int Object::dictGetLength() const { OBJECT_TYPE_CHECK(objDict); return dict->getLength(); } -inline void Object::dictAdd(const char *key, Object &&val) +inline void Object::dictAdd(char *key, Object &&val) { OBJECT_TYPE_CHECK(objDict); dict->add(key, std::move(val)); } inline void Object::dictSet(const char *key, Object &&val) @@ -377,7 +374,7 @@ inline Object Object::dictLookup(const char *key, int recursion) const inline Object Object::dictLookupNF(const char *key) const { OBJECT_TYPE_CHECK(objDict); return dict->lookupNF(key); } -inline const char *Object::dictGetKey(int i) const +inline char *Object::dictGetKey(int i) const { OBJECT_TYPE_CHECK(objDict); return dict->getKey(i); } inline Object Object::dictGetVal(int i) const diff --git a/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.cc b/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.cc index 717dc33d198..8376a0e4e4f 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.cc @@ -7,7 +7,6 @@ // Copyright 2008, 2010 Carlos Garcia Campos // Copyright 2008, 2010, 2011, 2017, 2018 Albert Astals Cid // Copyright 2008 Mark Kaplan -// Copyright 2018 Adam Reichold // // Released under the GPL (version 2, or later, at your option) // @@ -23,6 +22,7 @@ #include "goo/GooString.h" #include "goo/GooList.h" #include "Error.h" +// #include "PDFDocEncoding.h" #include "OptionalContent.h" // Max depth of nested visibility expressions. This is used to catch @@ -40,6 +40,8 @@ OCGs::OCGs(Object *ocgObject, XRef *xref) : { // we need to parse the dictionary here, and build optionalContentGroups ok = gTrue; + optionalContentGroups = new GooList(); + display = nullptr; Object ocgList = ocgObject->dictLookup("OCGs"); if (!ocgList.isArray()) { @@ -54,15 +56,17 @@ OCGs::OCGs(Object *ocgObject, XRef *xref) : if (!ocg.isDict()) { break; } - auto thisOptionalContentGroup = std::make_unique(ocg.getDict()); + OptionalContentGroup *thisOptionalContentGroup = new OptionalContentGroup(ocg.getDict()); ocg = ocgList.arrayGetNF(i); if (!ocg.isRef()) { + delete thisOptionalContentGroup; break; } + // TODO: we should create a lookup map from Ref to the OptionalContentGroup thisOptionalContentGroup->setRef( ocg.getRef() ); // the default is ON - we change state later, depending on BaseState, ON and OFF thisOptionalContentGroup->setState(OptionalContentGroup::On); - optionalContentGroups.emplace(ocg.getRef(), std::move(thisOptionalContentGroup)); + optionalContentGroups->append(thisOptionalContentGroup); } Object defaultOcgConfig = ocgObject->dictLookup("D"); @@ -74,8 +78,11 @@ OCGs::OCGs(Object *ocgObject, XRef *xref) : Object baseState = defaultOcgConfig.dictLookup("BaseState"); if (baseState.isName("OFF")) { - for (auto &group : optionalContentGroups) { - group.second->setState(OptionalContentGroup::Off); + for (int i = 0; i < optionalContentGroups->getLength(); ++i) { + OptionalContentGroup *group; + + group = (OptionalContentGroup *)optionalContentGroups->get(i); + group->setState(OptionalContentGroup::Off); } } @@ -119,26 +126,42 @@ OCGs::OCGs(Object *ocgObject, XRef *xref) : rbgroups = defaultOcgConfig.dictLookup("RBGroups"); } +OCGs::~OCGs() +{ + deleteGooList(optionalContentGroups, OptionalContentGroup); + delete display; +} + + bool OCGs::hasOCGs() const { - return !( optionalContentGroups.empty() ); + return ( optionalContentGroups->getLength() > 0 ); } -OptionalContentGroup* OCGs::findOcgByRef( const Ref &ref ) +OptionalContentGroup* OCGs::findOcgByRef( const Ref &ref) { - const auto ocg = optionalContentGroups.find( ref ); - return ocg != optionalContentGroups.end() ? ocg->second.get() : nullptr; + //TODO: make this more efficient + OptionalContentGroup *ocg = nullptr; + for (int i=0; i < optionalContentGroups->getLength(); ++i) { + ocg = (OptionalContentGroup*)optionalContentGroups->get(i); + if ( (ocg->getRef().num == ref.num) && (ocg->getRef().gen == ref.gen) ) { + return ocg; + } + } + + // not found + return nullptr; } OCDisplayNode *OCGs::getDisplayRoot() { if (display) - return display.get(); + return display; if (order.isArray()) - display.reset(OCDisplayNode::parse(&order, this, m_xref)); + display = OCDisplayNode::parse(&order, this, m_xref); - return display.get(); + return display; } bool OCGs::optContentIsVisible( Object *dictRef ) @@ -161,6 +184,7 @@ bool OCGs::optContentIsVisible( Object *dictRef ) return result; } dict = dictObj.getDict(); + // printf("checking if optContent is visible\n"); Object dictType = dict->lookup("Type"); if (dictType.isName("OCMD")) { Object ve = dict->lookup("VE"); @@ -189,12 +213,13 @@ bool OCGs::optContentIsVisible( Object *dictRef ) } } } - } else if ( dictType.isName("OCG") && dictRef->isRef() ) { + } else if ( dictType.isName("OCG") ) { OptionalContentGroup* oc = findOcgByRef( dictRef->getRef() ); if ( oc && oc->getState() == OptionalContentGroup::Off ) { result=false; } } + // printf("visibility: %s\n", result? "on" : "off"); return result; } diff --git a/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.h b/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.h index 6e9c52a61fd..ea5618e4374 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.h +++ b/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.h @@ -5,7 +5,6 @@ // Copyright 2007 Brad Hards // Copyright 2008 Carlos Garcia Campos // Copyright 2013, 2018 Albert Astals Cid -// Copyright 2018 Adam Reichold // // Released under the GPL (version 2, or later, at your option) // @@ -20,8 +19,6 @@ #include "Object.h" #include "CharTypes.h" -#include -#include class GooString; class GooList; @@ -36,6 +33,7 @@ class OCGs { public: OCGs(Object *ocgObject, XRef *xref); + ~OCGs(); OCGs(const OCGs &) = delete; OCGs& operator=(const OCGs &) = delete; @@ -44,7 +42,7 @@ public: GBool isOk() const { return ok; } bool hasOCGs() const; - const std::unordered_map< Ref, std::unique_ptr< OptionalContentGroup > > &getOCGs() const { return optionalContentGroups; } + GooList *getOCGs() const { return optionalContentGroups; } OptionalContentGroup* findOcgByRef( const Ref &ref); @@ -68,12 +66,12 @@ private: bool anyOn( Array *ocgArray ); bool anyOff( Array *ocgArray ); - std::unordered_map< Ref, std::unique_ptr< OptionalContentGroup > > optionalContentGroups; + GooList *optionalContentGroups; Object order; Object rbgroups; XRef *m_xref; - std::unique_ptr< OCDisplayNode > display; // root node of display tree + OCDisplayNode *display; // root node of display tree }; //------------------------------------------------------------------------ diff --git a/Build/source/libs/poppler/poppler-src/poppler/OutputDev.h b/Build/source/libs/poppler/poppler-src/poppler/OutputDev.h index 0a769307848..52635743838 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/OutputDev.h +++ b/Build/source/libs/poppler/poppler-src/poppler/OutputDev.h @@ -244,19 +244,7 @@ public: { return gFalse; } //----- path clipping - - // Update the clipping path. The new path is the intersection of the old path - // with the path given in 'state'. - // Additionally, set the clipping mode to the 'nonzero winding number rule'. - // That is, a point is inside the clipping region if its winding number - // with respect to the clipping path is nonzero. virtual void clip(GfxState * /*state*/) {} - - // Update the clipping path. The new path is the intersection of the old path - // with the path given in 'state'. - // Additionally, set the clipping mode to the 'even-odd rule'. That is, a point is - // inside the clipping region if a ray from it to infinity will cross the clipping - // path an odd number of times (disregarding the path orientation). virtual void eoClip(GfxState * /*state*/) {} virtual void clipToStrokePath(GfxState * /*state*/) {} diff --git a/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc b/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc index cb8fd0d7ff4..631f9a70782 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc @@ -29,7 +29,7 @@ // Copyright (C) 2011-2016 Thomas Freitag // Copyright (C) 2012, 2013 Fabio D'Urso // Copyright (C) 2013, 2014, 2017 Adrian Johnson -// Copyright (C) 2013, 2018 Adam Reichold +// Copyright (C) 2013 Adam Reichold // Copyright (C) 2014 Bogdan Cristea // Copyright (C) 2015 Li Junling // Copyright (C) 2015 André Guerreiro @@ -40,7 +40,6 @@ // Copyright (C) 2018 Ben Timby // Copyright (C) 2018 Evangelos Foutras // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich -// Copyright (C) 2018 Evangelos Rigas // // 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 @@ -63,7 +62,6 @@ #include #include #include -#include #include #include "goo/glibc.h" #include "goo/gstrtod.h" @@ -320,9 +318,6 @@ GBool PDFDoc::setup(GooString *ownerPassword, GooString *userPassword) { } } - // Extract PDF Subtype information - extractPDFSubtype(); - // done return gTrue; } @@ -487,133 +482,6 @@ GBool PDFDoc::checkEncryption(GooString *ownerPassword, GooString *userPassword) return ret; } -static PDFSubtypePart pdfPartFromString(PDFSubtype subtype, GooString *pdfSubtypeVersion) { - const std::regex regex("PDF/(?:A|X|VT|E|UA)-([[:digit:]])(?:[[:alpha:]]{1,2})?:?([[:digit:]]{4})?"); - std::smatch match; - std::string pdfsubver = pdfSubtypeVersion->toStr(); - PDFSubtypePart subtypePart = subtypePartNone; - - if (std::regex_search(pdfsubver, match, regex)) { - int date = 0; - const int part = std::stoi(match.str(1)); - - if (match[2].matched) { - date = std::stoi(match.str(2)); - } - - switch (subtype) { - case subtypePDFX: - switch (part) { - case 1: - switch (date) { - case 2001: - default: - subtypePart = subtypePart1; - break; - case 2003: - subtypePart = subtypePart4; - break; - } - break; - case 2: - subtypePart = subtypePart5; - break; - case 3: - switch (date) { - case 2002: - default: - subtypePart = subtypePart3; - break; - case 2003: - subtypePart = subtypePart6; - break; - } - break; - case 4: - subtypePart = subtypePart7; - break; - case 5: - subtypePart = subtypePart8; - break; - } - break; - default: - subtypePart = (PDFSubtypePart)part; - break; - - } - } - - return subtypePart; -} - -static PDFSubtypeConformance pdfConformanceFromString(GooString *pdfSubtypeVersion) { - const std::regex regex("PDF/(?:A|X|VT|E|UA)-[[:digit:]]([[:alpha:]]+)"); - std::smatch match; - const std::string pdfsubver = pdfSubtypeVersion->toStr(); - PDFSubtypeConformance pdfConf = subtypeConfNone; - - // match contains the PDF conformance (A, B, G, N, P, PG or U) - if (std::regex_search(pdfsubver, match, regex)) { - GooString *conf = new GooString(match.str(1)); - // Convert to lowercase as the conformance may appear in both cases - conf->lowerCase(); - if (conf->cmp("a")==0) { - pdfConf = subtypeConfA; - } else if (conf->cmp("b")==0) { - pdfConf = subtypeConfB; - } else if (conf->cmp("g")==0) { - pdfConf = subtypeConfG; - } else if (conf->cmp("n")==0) { - pdfConf = subtypeConfN; - } else if (conf->cmp("p")==0) { - pdfConf = subtypeConfP; - } else if (conf->cmp("pg")==0) { - pdfConf = subtypeConfPG; - } else if (conf->cmp("u")==0) { - pdfConf = subtypeConfU; - } else { - pdfConf = subtypeConfNone; - } - delete conf; - } - - return pdfConf; -} - -void PDFDoc::extractPDFSubtype() { - pdfSubtype = subtypeNull; - pdfPart = subtypePartNull; - pdfConformance = subtypeConfNull; - - GooString *pdfSubtypeVersion = nullptr; - // Find PDF InfoDict subtype key if any - if ((pdfSubtypeVersion = getDocInfoStringEntry("GTS_PDFA1Version"))) { - pdfSubtype = subtypePDFA; - } else if ((pdfSubtypeVersion = getDocInfoStringEntry("GTS_PDFEVersion"))) { - pdfSubtype = subtypePDFE; - } else if ((pdfSubtypeVersion = getDocInfoStringEntry("GTS_PDFUAVersion"))) { - pdfSubtype = subtypePDFUA; - } else if ((pdfSubtypeVersion = getDocInfoStringEntry("GTS_PDFVTVersion"))) { - pdfSubtype = subtypePDFVT; - } else if ((pdfSubtypeVersion = getDocInfoStringEntry("GTS_PDFXVersion"))) { - pdfSubtype = subtypePDFX; - } else { - pdfSubtype = subtypeNone; - pdfPart = subtypePartNone; - pdfConformance = subtypeConfNone; - return; - } - - // Extract part from version string - pdfPart = pdfPartFromString(pdfSubtype, pdfSubtypeVersion); - - // Extract conformance from version string - pdfConformance = pdfConformanceFromString(pdfSubtypeVersion); - - delete pdfSubtypeVersion; -} - std::vector PDFDoc::getSignatureWidgets() { int num_pages = getNumPages(); @@ -1777,7 +1645,7 @@ void PDFDoc::replacePageDict(int pageNo, int rotate, mediaBoxArray->add(Object(mediaBox->y2)); Object mediaBoxObject(mediaBoxArray); Object trimBoxObject = mediaBoxObject.copy(); - pageDict->add("MediaBox", std::move(mediaBoxObject)); + pageDict->add(copyString("MediaBox"), std::move(mediaBoxObject)); if (cropBox != nullptr) { Array *cropBoxArray = new Array(getXRef()); cropBoxArray->add(Object(cropBox->x1)); @@ -1786,10 +1654,10 @@ void PDFDoc::replacePageDict(int pageNo, int rotate, cropBoxArray->add(Object(cropBox->y2)); Object cropBoxObject(cropBoxArray); trimBoxObject = cropBoxObject.copy(); - pageDict->add("CropBox", std::move(cropBoxObject)); + pageDict->add(copyString("CropBox"), std::move(cropBoxObject)); } - pageDict->add("TrimBox", std::move(trimBoxObject)); - pageDict->add("Rotate", Object(rotate)); + pageDict->add(copyString("TrimBox"), std::move(trimBoxObject)); + pageDict->add(copyString("Rotate"), Object(rotate)); getXRef()->setModifiedObject(&page, *refPage); } diff --git a/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.h b/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.h index 3353db7463c..1678d1678e9 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.h +++ b/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.h @@ -31,7 +31,6 @@ // Copyright (C) 2015 André Esser // Copyright (C) 2016 Jakub Alba // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich -// Copyright (C) 2018 Evangelos Rigas // // 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 @@ -75,41 +74,6 @@ enum PDFWriteMode { writeForceIncremental }; -enum PDFSubtype { - subtypeNull, - subtypePDFA, - subtypePDFE, - subtypePDFUA, - subtypePDFVT, - subtypePDFX, - subtypeNone -}; - -enum PDFSubtypePart { - subtypePartNull, - subtypePart1, - subtypePart2, - subtypePart3, - subtypePart4, - subtypePart5, - subtypePart6, - subtypePart7, - subtypePart8, - subtypePartNone -}; - -enum PDFSubtypeConformance { - subtypeConfNull, - subtypeConfA, - subtypeConfB, - subtypeConfG, - subtypeConfN, - subtypeConfP, - subtypeConfPG, - subtypeConfU, - subtypeConfNone -}; - //------------------------------------------------------------------------ // PDFDoc //------------------------------------------------------------------------ @@ -309,11 +273,6 @@ public: GooString *getDocInfoCreatDate() { return getDocInfoStringEntry("CreationDate"); } GooString *getDocInfoModDate() { return getDocInfoStringEntry("ModDate"); } - // Return the PDF subtype, part, and conformance - PDFSubtype getPDFSubtype() const { return pdfSubtype; } - PDFSubtypePart getPDFSubtypePart() const { return pdfPart; } - PDFSubtypeConformance getPDFSubtypeConformance() const { return pdfConformance; } - // Return the PDF version specified by the file. int getPDFMajorVersion() { return pdfMajorVersion; } int getPDFMinorVersion() { return pdfMinorVersion; } @@ -387,8 +346,6 @@ private: GBool checkFooter(); void checkHeader(); GBool checkEncryption(GooString *ownerPassword, GooString *userPassword); - void extractPDFSubtype(); - // Get the offset of the start xref table. Goffset getStartXRef(GBool tryingToReconstruct = gFalse); // Get the offset of the entries in the main XRef table of a @@ -408,9 +365,6 @@ private: void *guiData; int pdfMajorVersion; int pdfMinorVersion; - PDFSubtype pdfSubtype; - PDFSubtypePart pdfPart; - PDFSubtypeConformance pdfConformance; Linearization *linearization; // linearizationState = 0: unchecked // linearizationState = 1: checked and valid diff --git a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc index d6a3177313a..d1ead5862a8 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc @@ -33,7 +33,6 @@ // Copyright (C) 2016 Caolán McNamara // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich // Copyright (C) 2018 Adam Reichold -// Copyright (C) 2018 Philipp Knechtges // // 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 @@ -53,7 +52,6 @@ #include #include #include -#include #include "goo/GooString.h" #include "goo/GooList.h" #include "poppler-config.h" @@ -4929,60 +4927,6 @@ GBool PSOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, return gTrue; } -GBool PSOutputDev::patchMeshShadedFill(GfxState *state, - GfxPatchMeshShading *shading) { - // TODO: support parametrized shading - if (level < psLevel3 || shading->isParameterized()) { - return gFalse; - } - - writePS("%% Begin patchMeshShadedFill\n"); - - // ShadingType 7 shadings are pretty much the same for pdf and ps. - // As such, we basically just need to invert GfxPatchMeshShading::parse here. - - writePS("<<\n"); - writePS(" /ShadingType 7\n"); - writePS(" /ColorSpace "); - dumpColorSpaceL2(shading->getColorSpace(), gFalse, gFalse, gFalse); - writePS("\n"); - writePS(" /DataSource [\n"); - - const int ncomps = shading->getColorSpace()->getNComps(); - - for (int i = 0; i < shading->getNPatches(); ++i) { - const auto& patch = *shading->getPatch(i); - // Print Flag, for us always f = 0 - writePS(" 0 \n"); - - // Print coordinates - const std::array, 16> coordindices = {{ {0,0}, {0,1}, {0,2}, {0,3}, - {1,3}, {2,3}, {3,3}, {3,2}, - {3,1}, {3,0}, {2,0}, {1,0}, - {1,1}, {1,2}, {2,2}, {2,1} }}; - for (const auto& index: coordindices) { - writePSFmt(" {0:.6g} {1:.6g}\n", patch.x[index.first][index.second], - patch.y[index.first][index.second]); - } - - // Print colors - const std::array, 4> colindices = {{ {0,0}, {0,1}, {1,1}, {1,0} }}; - for (const auto& index: colindices) { - writePS(" "); - for (int comp = 0; comp < ncomps; ++comp) { - writePSFmt(" {0:.6g}", colToDbl(patch.color[index.first][index.second].c[comp])); - } - writePS("\n"); - } - } - - writePS(" ]\n"); - - writePS(">> shfill\n"); - writePS("%% End patchMeshShadedFill\n"); - return gTrue; -} - void PSOutputDev::clip(GfxState *state) { doPath(state->getPath()); writePS("W\n"); diff --git a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h index ef6106bbe34..b51cf472977 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h +++ b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h @@ -26,7 +26,6 @@ // Copyright (C) 2012 Fabio D'Urso // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich // Copyright (C) 2018 Adam Reichold -// Copyright (C) 2018 Philipp Knechtges // // 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 @@ -153,7 +152,7 @@ public: // radialShadedFill()? If this returns false, these shaded fills // will be reduced to a series of other drawing operations. GBool useShadedFills(int type) override - { return (type < 4 && level >= psLevel2) || (type == 7 && level >= psLevel3); } + { return type < 4 && level >= psLevel2; } // Does this device use drawForm()? If this returns false, // form-type XObjects will be interpreted (i.e., unrolled). @@ -250,7 +249,6 @@ public: GfxFunctionShading *shading) override; GBool axialShadedFill(GfxState *state, GfxAxialShading *shading, double /*tMin*/, double /*tMax*/) override; GBool radialShadedFill(GfxState *state, GfxRadialShading *shading, double /*sMin*/, double /*sMax*/) override; - GBool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) override; //----- path clipping void clip(GfxState *state) override; diff --git a/Build/source/libs/poppler/poppler-src/poppler/Parser.cc b/Build/source/libs/poppler/poppler-src/poppler/Parser.cc index 1d5240c9d65..8b0093e3fcf 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Parser.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Parser.cc @@ -20,7 +20,6 @@ // Copyright (C) 2013 Adrian Johnson // Copyright (C) 2013 Thomas Freitag // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich -// Copyright (C) 2018 Adam Reichold // // 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 @@ -113,18 +112,20 @@ Object Parser::getObj(GBool simpleOnly, if (strict) goto err; shift(); } else { - // buf1 will go away in shift(), so keep the key - const auto key = std::move(buf1); + // buf1 might go away in shift(), so construct the key + char *key = copyString(buf1.getName()); shift(); if (buf1.isEOF() || buf1.isError()) { + gfree(key); if (strict && buf1.isError()) goto err; break; } Object obj2 = getObj(gFalse, fileKey, encAlgorithm, keyLength, objNum, objGen, recursion + 1); if (unlikely(obj2.isError() && recursion + 1 >= recursionLimit)) { + gfree(key); break; } - obj.dictAdd(key.getName(), std::move(obj2)); + obj.dictAdd(key, std::move(obj2)); } } if (buf1.isEOF()) { diff --git a/Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.cc b/Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.cc index 11e47e5bdb2..76a54c0c083 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.cc @@ -127,16 +127,16 @@ void SignatureInfo::setSubjectDN(const char *subjectDN) subject_dn = strdup(subjectDN); } -void SignatureInfo::setLocation(const char *loc) +void SignatureInfo::setLocation(char *loc) { free(location); - location = strdup(loc); + location = loc; } -void SignatureInfo::setReason(const char *signingReason) +void SignatureInfo::setReason(char *signingReason) { free(reason); - reason = strdup(signingReason); + reason = signingReason; } void SignatureInfo::setHashAlgorithm(int type) diff --git a/Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.h b/Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.h index f4554c60a6f..1e9f5f9d63e 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.h +++ b/Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.h @@ -61,8 +61,8 @@ public: void setCertificateValStatus(enum CertificateValidationStatus ); void setSignerName(char *); void setSubjectDN(const char *); - void setLocation(const char *); - void setReason(const char *); + void setLocation(char *); + void setReason(char *); void setHashAlgorithm(int); void setSigningTime(time_t); void setSubFilterSupport(bool isSupported) { sig_subfilter_supported = isSupported; } diff --git a/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc index 6faa7477866..3e883970e3e 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc @@ -2294,71 +2294,88 @@ reload: } void SplashOutputDev::stroke(GfxState *state) { + SplashPath *path; + if (state->getStrokeColorSpace()->isNonMarking()) { return; } setOverprintMask(state->getStrokeColorSpace(), state->getStrokeOverprint(), state->getOverprintMode(), state->getStrokeColor()); - SplashPath path = convertPath(state, state->getPath(), gFalse); - splash->stroke(&path); + path = convertPath(state, state->getPath(), gFalse); + splash->stroke(path); + delete path; } void SplashOutputDev::fill(GfxState *state) { + SplashPath *path; + if (state->getFillColorSpace()->isNonMarking()) { return; } setOverprintMask(state->getFillColorSpace(), state->getFillOverprint(), state->getOverprintMode(), state->getFillColor()); - SplashPath path = convertPath(state, state->getPath(), gTrue); - splash->fill(&path, gFalse); + path = convertPath(state, state->getPath(), gTrue); + splash->fill(path, gFalse); + delete path; } void SplashOutputDev::eoFill(GfxState *state) { + SplashPath *path; + if (state->getFillColorSpace()->isNonMarking()) { return; } setOverprintMask(state->getFillColorSpace(), state->getFillOverprint(), state->getOverprintMode(), state->getFillColor()); - SplashPath path = convertPath(state, state->getPath(), gTrue); - splash->fill(&path, gTrue); + path = convertPath(state, state->getPath(), gTrue); + splash->fill(path, gTrue); + delete path; } void SplashOutputDev::clip(GfxState *state) { - SplashPath path = convertPath(state, state->getPath(), gTrue); - splash->clipToPath(&path, gFalse); + SplashPath *path; + + path = convertPath(state, state->getPath(), gTrue); + splash->clipToPath(path, gFalse); + delete path; } void SplashOutputDev::eoClip(GfxState *state) { - SplashPath path = convertPath(state, state->getPath(), gTrue); - splash->clipToPath(&path, gTrue); + SplashPath *path; + + path = convertPath(state, state->getPath(), gTrue); + splash->clipToPath(path, gTrue); + delete path; } void SplashOutputDev::clipToStrokePath(GfxState *state) { - SplashPath *path2; + SplashPath *path, *path2; - SplashPath path = convertPath(state, state->getPath(), gFalse); - path2 = splash->makeStrokePath(&path, state->getLineWidth()); + path = convertPath(state, state->getPath(), gFalse); + path2 = splash->makeStrokePath(path, state->getLineWidth()); + delete path; splash->clipToPath(path2, gFalse); delete path2; } -SplashPath SplashOutputDev::convertPath(GfxState *state, GfxPath *path, +SplashPath *SplashOutputDev::convertPath(GfxState *state, GfxPath *path, GBool dropEmptySubpaths) { - SplashPath sPath; + SplashPath *sPath; GfxSubpath *subpath; int n, i, j; n = dropEmptySubpaths ? 1 : 0; + sPath = new SplashPath(); for (i = 0; i < path->getNumSubpaths(); ++i) { subpath = path->getSubpath(i); if (subpath->getNumPoints() > n) { - sPath.reserve(subpath->getNumPoints() + 1); - sPath.moveTo((SplashCoord)subpath->getX(0), + sPath->reserve(subpath->getNumPoints() + 1); + sPath->moveTo((SplashCoord)subpath->getX(0), (SplashCoord)subpath->getY(0)); j = 1; while (j < subpath->getNumPoints()) { if (subpath->getCurve(j)) { - sPath.curveTo((SplashCoord)subpath->getX(j), + sPath->curveTo((SplashCoord)subpath->getX(j), (SplashCoord)subpath->getY(j), (SplashCoord)subpath->getX(j+1), (SplashCoord)subpath->getY(j+1), @@ -2366,13 +2383,13 @@ SplashPath SplashOutputDev::convertPath(GfxState *state, GfxPath *path, (SplashCoord)subpath->getY(j+2)); j += 3; } else { - sPath.lineTo((SplashCoord)subpath->getX(j), + sPath->lineTo((SplashCoord)subpath->getX(j), (SplashCoord)subpath->getY(j)); ++j; } } if (subpath->isClosed()) { - sPath.close(); + sPath->close(); } } } @@ -3553,16 +3570,14 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn_checkoverflow(n, 4); - if (likely(imgData.lookup != nullptr)) { - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - colorMap->getRGB(&pix, &rgb); - imgData.lookup[4*i] = colToByte(rgb.r); - imgData.lookup[4*i+1] = colToByte(rgb.g); - imgData.lookup[4*i+2] = colToByte(rgb.b); - imgData.lookup[4*i+3] = 255; - } + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); + for (i = 0; i < n; ++i) { + pix = (Guchar)i; + colorMap->getRGB(&pix, &rgb); + imgData.lookup[4*i] = colToByte(rgb.r); + imgData.lookup[4*i+1] = colToByte(rgb.g); + imgData.lookup[4*i+2] = colToByte(rgb.b); + imgData.lookup[4*i+3] = 255; } break; #ifdef SPLASH_CMYK @@ -4071,16 +4086,14 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn_checkoverflow(n, 4); - if (likely(imgData.lookup != nullptr)) { - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - colorMap->getRGB(&pix, &rgb); - imgData.lookup[4*i] = colToByte(rgb.r); - imgData.lookup[4*i+1] = colToByte(rgb.g); - imgData.lookup[4*i+2] = colToByte(rgb.b); - imgData.lookup[4*i+3] = 255; - } + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); + for (i = 0; i < n; ++i) { + pix = (Guchar)i; + colorMap->getRGB(&pix, &rgb); + imgData.lookup[4*i] = colToByte(rgb.r); + imgData.lookup[4*i+1] = colToByte(rgb.g); + imgData.lookup[4*i+2] = colToByte(rgb.b); + imgData.lookup[4*i+3] = 255; } break; #ifdef SPLASH_CMYK @@ -4771,6 +4784,7 @@ GBool SplashOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTria GBool SplashOutputDev::univariateShadedFill(GfxState *state, SplashUnivariatePattern *pattern, double tMin, double tMax) { double xMin, yMin, xMax, yMax; + SplashPath *path; GBool vaa = getVectorAntialias(); // restore vector antialias because we support it here setVectorAntialias(gTrue); @@ -4817,16 +4831,17 @@ GBool SplashOutputDev::univariateShadedFill(GfxState *state, SplashUnivariatePat state->lineTo(xMax, yMax); state->lineTo(xMin, yMax); state->closePath(); - SplashPath path = convertPath(state, state->getPath(), gTrue); + path = convertPath(state, state->getPath(), gTrue); #ifdef SPLASH_CMYK pattern->getShading()->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS); #endif setOverprintMask(pattern->getShading()->getColorSpace(), state->getFillOverprint(), state->getOverprintMode(), nullptr); - retVal = (splash->shadedFill(&path, pattern->getShading()->getHasBBox(), pattern) == splashOk); + retVal = (splash->shadedFill(path, pattern->getShading()->getHasBBox(), pattern) == splashOk); state->clearPath(); setVectorAntialias(vaa); + delete path; return retVal; } @@ -4834,6 +4849,7 @@ GBool SplashOutputDev::univariateShadedFill(GfxState *state, SplashUnivariatePat GBool SplashOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) { SplashFunctionPattern *pattern = new SplashFunctionPattern(colorMode, state, shading); double xMin, yMin, xMax, yMax; + SplashPath *path; GBool vaa = getVectorAntialias(); // restore vector antialias because we support it here setVectorAntialias(gTrue); @@ -4880,16 +4896,17 @@ GBool SplashOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *s state->lineTo(xMax, yMax); state->lineTo(xMin, yMax); state->closePath(); - SplashPath path = convertPath(state, state->getPath(), gTrue); + path = convertPath(state, state->getPath(), gTrue); #ifdef SPLASH_CMYK pattern->getShading()->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS); #endif setOverprintMask(pattern->getShading()->getColorSpace(), state->getFillOverprint(), state->getOverprintMode(), nullptr); - retVal = (splash->shadedFill(&path, pattern->getShading()->getHasBBox(), pattern) == splashOk); + retVal = (splash->shadedFill(path, pattern->getShading()->getHasBBox(), pattern) == splashOk); state->clearPath(); setVectorAntialias(vaa); + delete path; delete pattern; diff --git a/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h b/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h index 4d72d9c7a8f..3a1b594e409 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h +++ b/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h @@ -22,7 +22,6 @@ // Copyright (C) 2011, 2017 Adrian Johnson // Copyright (C) 2012, 2015, 2018 Albert Astals Cid // Copyright (C) 2015, 2016 William Bader -// Copyright (C) 2018 Stefan Brüns // // 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 @@ -411,7 +410,7 @@ private: static void getMatteColor( SplashColorMode colorMode, GfxImageColorMap *colorMap, GfxColor * matteColor, SplashColor splashMatteColor); void setOverprintMask(GfxColorSpace *colorSpace, GBool overprintFlag, int overprintMode, GfxColor *singleColor, GBool grayIndexed = gFalse); - SplashPath convertPath(GfxState *state, GfxPath *path, + SplashPath *convertPath(GfxState *state, GfxPath *path, GBool dropEmptySubpaths); void drawType3Glyph(GfxState *state, T3FontCache *t3Font, T3FontCacheTag *tag, Guchar *data); diff --git a/Build/source/libs/poppler/poppler-src/poppler/StructTreeRoot.cc b/Build/source/libs/poppler/poppler-src/poppler/StructTreeRoot.cc index 954b76a741c..58a4b6a63c7 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/StructTreeRoot.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/StructTreeRoot.cc @@ -9,7 +9,6 @@ // Copyright 2017 Jan-Erik S // Copyright 2017, 2018 Albert Astals Cid // Copyright 2017, 2018 Adrian Johnson -// Copyright 2018, Adam Reichold // //======================================================================== @@ -111,7 +110,7 @@ void StructTreeRoot::parse(Dict *root) } // refToParentMap is only used during parsing. Ensure all memory used by it is freed. - std::multimap().swap(refToParentMap); + std::multimap().swap(refToParentMap); } void StructTreeRoot::parseNumberTreeNode(Dict *node) diff --git a/Build/source/libs/poppler/poppler-src/poppler/StructTreeRoot.h b/Build/source/libs/poppler/poppler-src/poppler/StructTreeRoot.h index 90848649ae5..89c7941cebf 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/StructTreeRoot.h +++ b/Build/source/libs/poppler/poppler-src/poppler/StructTreeRoot.h @@ -7,7 +7,6 @@ // Copyright 2013, 2014 Igalia S.L. // Copyright 2018 Albert Astals Cid // Copyright 2018 Adrian Johnson -// Copyright 2018 Adam Reichold // //======================================================================== @@ -80,7 +79,7 @@ private: Object classMap; ElemPtrArray elements; std::map > parentTree; - std::multimap refToParentMap; + std::multimap refToParentMap; void parse(Dict *rootDict); void parseNumberTreeNode(Dict *node); diff --git a/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc index 7a92ff3b613..4a3070af7c0 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc @@ -37,7 +37,6 @@ // Copyright (C) 2013 Ed Catmur // Copyright (C) 2016 Khaled Hosny // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich -// Copyright (C) 2018 Sanchit Anand // // 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 @@ -5879,7 +5878,3 @@ TextPage *TextOutputDev::takeText() { text = new TextPage(rawOrder); return ret; } - -TextFlow *TextOutputDev::getFlows() { - return text->getFlows(); -} diff --git a/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.h b/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.h index f243554540b..092acd6730f 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.h +++ b/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.h @@ -22,7 +22,6 @@ // Copyright (C) 2012, 2013, 2015, 2016 Jason Crain // Copyright (C) 2013 Thomas Freitag // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich -// Copyright (C) 2018 Sanchit Anand // // 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 @@ -891,10 +890,6 @@ public: // Turn extra processing for HTML conversion on or off. void enableHTMLExtras(GBool doHTMLA) { doHTML = doHTMLA; } - // Get the head of the linked list of TextFlows for the - // last rasterized page. - TextFlow *getFlows(); - private: TextOutputFunc outputFunc; // output function diff --git a/Build/source/libs/poppler/poppler-src/poppler/XRef.cc b/Build/source/libs/poppler/poppler-src/poppler/XRef.cc index 078274b4518..4352146ec45 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/XRef.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/XRef.cc @@ -773,10 +773,10 @@ GBool XRef::readXRefStream(Stream *xrefStr, Goffset *pos) { } obj = dict->lookupNF("Prev"); - if (obj.isInt() && obj.getInt() >= 0) { + if (obj.isInt()) { *pos = obj.getInt(); more = gTrue; - } else if (obj.isInt64() && obj.getInt64() >= 0) { + } else if (obj.isInt64()) { *pos = obj.getInt64(); more = gTrue; } else { diff --git a/Build/source/libs/poppler/poppler-src/poppler/poppler-config.h.cmake b/Build/source/libs/poppler/poppler-src/poppler/poppler-config.h.cmake index 20e3dd38393..f6a6c27ff6b 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/poppler-config.h.cmake +++ b/Build/source/libs/poppler/poppler-src/poppler/poppler-config.h.cmake @@ -17,7 +17,6 @@ // Copyright (C) 2014 Hib Eris // Copyright (C) 2016 Tor Lillqvist // Copyright (C) 2017 Adrian Johnson -// Copyright (C) 2018 Adam Reichold // // 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 @@ -122,7 +121,8 @@ // Also, there are preprocessor symbols in the header files // that are used but never defined when building poppler using configure -// or cmake: DISABLE_OUTLINE, ENABLE_PLUGINS, DEBUG_FORMS +// or cmake: DISABLE_OUTLINE, DEBUG_MEM, +// ENABLE_PLUGINS, DEBUG_FORMS //------------------------------------------------------------------------ // version diff --git a/Build/source/libs/poppler/version.ac b/Build/source/libs/poppler/version.ac index c03436580de..7f633325435 100644 --- a/Build/source/libs/poppler/version.ac +++ b/Build/source/libs/poppler/version.ac @@ -9,4 +9,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current poppler version -m4_define([poppler_version], [0.69.0]) +m4_define([poppler_version], [0.68.0]) -- cgit v1.2.3