summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-03-18 22:48:34 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-03-18 22:48:34 +0000
commit870b25c98edb0948ac01b134b3ed8447addd82d9 (patch)
tree512b702283cffb60e19c75ec42a6f4517b147cdc /Build
parent3b0937b0e82d0a084f90b0cba83814d035f36b31 (diff)
poppler 0.42.0 (sync with the luatex trunk)
git-svn-id: svn://tug.org/texlive/trunk@40068 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/libs/README2
-rw-r--r--Build/source/libs/poppler/ChangeLog7
-rw-r--r--Build/source/libs/poppler/Makefile.am3
-rw-r--r--Build/source/libs/poppler/Makefile.in6
-rwxr-xr-xBuild/source/libs/poppler/configure22
-rw-r--r--Build/source/libs/poppler/poppler-PATCHES/ChangeLog7
-rw-r--r--Build/source/libs/poppler/poppler-PATCHES/TL-Changes2
-rw-r--r--Build/source/libs/poppler/poppler-PATCHES/patch-02-LLONG_MAX6
-rw-r--r--Build/source/libs/poppler/poppler-PATCHES/patch-03-Object-functions14
-rw-r--r--Build/source/libs/poppler/poppler-src/CMakeLists.txt40
-rw-r--r--Build/source/libs/poppler/poppler-src/ChangeLog757
-rw-r--r--Build/source/libs/poppler/poppler-src/Makefile.am1
-rw-r--r--Build/source/libs/poppler/poppler-src/NEWS28
-rw-r--r--Build/source/libs/poppler/poppler-src/config.h.cmake8
-rw-r--r--Build/source/libs/poppler/poppler-src/config.h.in8
-rw-r--r--Build/source/libs/poppler/poppler-src/configure.ac119
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/DateInfo.cc26
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/DateInfo.h3
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/Decrypt.cc357
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/FlateEncoder.cc148
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/FlateEncoder.h73
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/FlateStream.cc15
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/Form.cc169
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/Form.h18
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/Gfx.cc56
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/GfxState.cc13
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/GfxState.h7
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/JPEG2000Stream.cc131
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/Makefile.am37
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/Object.h12
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc25
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/PDFDoc.h7
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc228
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h13
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/SecurityHandler.cc9
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/SignatureHandler.cc339
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/SignatureHandler.h70
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.cc87
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.h71
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc210
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h36
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/Stream.cc151
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/Stream.h42
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc44
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.h6
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/XRef.cc8
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/XRef.h3
-rw-r--r--Build/source/libs/poppler/poppler-src/poppler/poppler-config.h.in6
-rw-r--r--Build/source/libs/poppler/version.ac2
49 files changed, 3233 insertions, 219 deletions
diff --git a/Build/source/libs/README b/Build/source/libs/README
index 6b10918a774..8825d906560 100644
--- a/Build/source/libs/README
+++ b/Build/source/libs/README
@@ -49,7 +49,7 @@ mpfr 3.1.4 - checked 07mar16
pixman 0.34.0 - checked 04feb16
http://cairographics.org/releases/
-poppler 0.41.0 - checked 17feb16
+poppler 0.42.0 - checked 18mar16
http://poppler.freedesktop.org/ - used by luatex and xetex
potrace 1.13 - checked 28dec15
diff --git a/Build/source/libs/poppler/ChangeLog b/Build/source/libs/poppler/ChangeLog
index 0435fa06421..332fcdbb43d 100644
--- a/Build/source/libs/poppler/ChangeLog
+++ b/Build/source/libs/poppler/ChangeLog
@@ -1,8 +1,15 @@
+2016-03-18 Luigi Scarso <luigi.scarso@gmail.com>
+
+ Import poppler-0.42.0.
+ * version.ac: Adjust.
+
+
2016-02-17 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
Import poppler-0.41.0.
* version.ac: Adjust.
+
2016-02-15 Karl Berry <karl@tug.org>
* poppler-PATCHES: rename from poppler-src-PATCHES.
diff --git a/Build/source/libs/poppler/Makefile.am b/Build/source/libs/poppler/Makefile.am
index 0c3f0343e4b..46037db59ed 100644
--- a/Build/source/libs/poppler/Makefile.am
+++ b/Build/source/libs/poppler/Makefile.am
@@ -59,6 +59,8 @@ fofi_libfofi_a_sources = \
@POPPLER_TREE@/fofi/FoFiType1.cc \
@POPPLER_TREE@/fofi/FoFiType1C.cc
+
+
poppler_libpoppler_a_sources = \
@POPPLER_TREE@/poppler/Annot.cc \
@POPPLER_TREE@/poppler/Array.cc \
@@ -109,6 +111,7 @@ poppler_libpoppler_a_sources = \
@POPPLER_TREE@/poppler/ProfileData.cc \
@POPPLER_TREE@/poppler/Rendition.cc \
@POPPLER_TREE@/poppler/SecurityHandler.cc \
+ @POPPLER_TREE@/poppler/SignatureInfo.cc \
@POPPLER_TREE@/poppler/Sound.cc \
@POPPLER_TREE@/poppler/StdinCachedFile.cc \
@POPPLER_TREE@/poppler/StdinPDFDocBuilder.cc \
diff --git a/Build/source/libs/poppler/Makefile.in b/Build/source/libs/poppler/Makefile.in
index 980f969ddf1..0c7928604cd 100644
--- a/Build/source/libs/poppler/Makefile.in
+++ b/Build/source/libs/poppler/Makefile.in
@@ -179,6 +179,7 @@ am__objects_3 = @POPPLER_TREE@/poppler/Annot.$(OBJEXT) \
@POPPLER_TREE@/poppler/ProfileData.$(OBJEXT) \
@POPPLER_TREE@/poppler/Rendition.$(OBJEXT) \
@POPPLER_TREE@/poppler/SecurityHandler.$(OBJEXT) \
+ @POPPLER_TREE@/poppler/SignatureInfo.$(OBJEXT) \
@POPPLER_TREE@/poppler/Sound.$(OBJEXT) \
@POPPLER_TREE@/poppler/StdinCachedFile.$(OBJEXT) \
@POPPLER_TREE@/poppler/StdinPDFDocBuilder.$(OBJEXT) \
@@ -518,6 +519,7 @@ poppler_libpoppler_a_sources = \
@POPPLER_TREE@/poppler/ProfileData.cc \
@POPPLER_TREE@/poppler/Rendition.cc \
@POPPLER_TREE@/poppler/SecurityHandler.cc \
+ @POPPLER_TREE@/poppler/SignatureInfo.cc \
@POPPLER_TREE@/poppler/Sound.cc \
@POPPLER_TREE@/poppler/StdinCachedFile.cc \
@POPPLER_TREE@/poppler/StdinPDFDocBuilder.cc \
@@ -818,6 +820,9 @@ clean-noinstLIBRARIES:
@POPPLER_TREE@/poppler/SecurityHandler.$(OBJEXT): \
@POPPLER_TREE@/poppler/$(am__dirstamp) \
@POPPLER_TREE@/poppler/$(DEPDIR)/$(am__dirstamp)
+@POPPLER_TREE@/poppler/SignatureInfo.$(OBJEXT): \
+ @POPPLER_TREE@/poppler/$(am__dirstamp) \
+ @POPPLER_TREE@/poppler/$(DEPDIR)/$(am__dirstamp)
@POPPLER_TREE@/poppler/Sound.$(OBJEXT): \
@POPPLER_TREE@/poppler/$(am__dirstamp) \
@POPPLER_TREE@/poppler/$(DEPDIR)/$(am__dirstamp)
@@ -937,6 +942,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/ProfileData.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/Rendition.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/SecurityHandler.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/SignatureInfo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/Sound.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/StdinCachedFile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/StdinPDFDocBuilder.Po@am__quote@
diff --git a/Build/source/libs/poppler/configure b/Build/source/libs/poppler/configure
index 4be4545b980..0d7f9b2a600 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.41.0.
+# Generated by GNU Autoconf 2.69 for poppler (TeX Live) 0.42.0.
#
# Report bugs to <tex-k@tug.org>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='poppler (TeX Live)'
PACKAGE_TARNAME='poppler--tex-live-'
-PACKAGE_VERSION='0.41.0'
-PACKAGE_STRING='poppler (TeX Live) 0.41.0'
+PACKAGE_VERSION='0.42.0'
+PACKAGE_STRING='poppler (TeX Live) 0.42.0'
PACKAGE_BUGREPORT='tex-k@tug.org'
PACKAGE_URL=''
@@ -1306,7 +1306,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.41.0 to adapt to many kinds of systems.
+\`configure' configures poppler (TeX Live) 0.42.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1373,7 +1373,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of poppler (TeX Live) 0.41.0:";;
+ short | recursive ) echo "Configuration of poppler (TeX Live) 0.42.0:";;
esac
cat <<\_ACEOF
@@ -1486,7 +1486,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-poppler (TeX Live) configure 0.41.0
+poppler (TeX Live) configure 0.42.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2076,7 +2076,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.41.0, which was
+It was created by poppler (TeX Live) $as_me 0.42.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3999,7 +3999,7 @@ fi
# Define the identity of the package.
PACKAGE='poppler--tex-live-'
- VERSION='0.41.0'
+ VERSION='0.42.0'
# Some tools Automake needs.
@@ -6578,7 +6578,7 @@ ac_config_headers="$ac_config_headers poppler-config.h:poppler-src/poppler/poppl
cat >>confdefs.h <<_ACEOF
-#define POPPLER_VERSION "0.41.0"
+#define POPPLER_VERSION "0.42.0"
_ACEOF
@@ -7272,7 +7272,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.41.0, which was
+This file was extended by poppler (TeX Live) $as_me 0.42.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -7338,7 +7338,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.41.0
+poppler (TeX Live) config.status 0.42.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/Build/source/libs/poppler/poppler-PATCHES/ChangeLog b/Build/source/libs/poppler/poppler-PATCHES/ChangeLog
index 984bcde54c3..37acfb07695 100644
--- a/Build/source/libs/poppler/poppler-PATCHES/ChangeLog
+++ b/Build/source/libs/poppler/poppler-PATCHES/ChangeLog
@@ -1,3 +1,10 @@
+2016-03-18 Luigi Scarso <luigi.scarso@gmail.com>
+
+ Imported poppler-0.42.0 source tree from:
+ http://poppler.freedesktop.org/
+ Added @POPPLER_TREE@/poppler/SignatureInfo.cc to Makefile.am
+
+
2016-02-17 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
Imported poppler-0.41.0 source tree from:
diff --git a/Build/source/libs/poppler/poppler-PATCHES/TL-Changes b/Build/source/libs/poppler/poppler-PATCHES/TL-Changes
index 0b03254b31c..2a89513c818 100644
--- a/Build/source/libs/poppler/poppler-PATCHES/TL-Changes
+++ b/Build/source/libs/poppler/poppler-PATCHES/TL-Changes
@@ -1,4 +1,4 @@
-Changes applied to the poppler-0.41.0 tree as obtained from:
+Changes applied to the poppler-0.42.0 tree as obtained from:
http://poppler.freedesktop.org/
Removed:
diff --git a/Build/source/libs/poppler/poppler-PATCHES/patch-02-LLONG_MAX b/Build/source/libs/poppler/poppler-PATCHES/patch-02-LLONG_MAX
index 64a7c87f9b8..09e5f57303f 100644
--- a/Build/source/libs/poppler/poppler-PATCHES/patch-02-LLONG_MAX
+++ b/Build/source/libs/poppler/poppler-PATCHES/patch-02-LLONG_MAX
@@ -1,6 +1,6 @@
-diff -ur poppler-0.41.0.orig/goo/GooString.h poppler-0.41.0/goo/GooString.h
---- poppler-0.41.0.orig/goo/GooString.h Mon Jul 13 00:05:10 2015
-+++ poppler-0.41.0/goo/GooString.h Wed Feb 17 15:36:48 2016
+diff -ur poppler-src-orig/goo/GooString.h poppler-src/goo/GooString.h
+--- poppler-src-orig/goo/GooString.h 2016-02-19 10:05:07.000000000 +0100
++++ poppler-src/goo/GooString.h 2016-03-17 10:52:54.000000000 +0100
@@ -35,6 +35,21 @@
#endif
diff --git a/Build/source/libs/poppler/poppler-PATCHES/patch-03-Object-functions b/Build/source/libs/poppler/poppler-PATCHES/patch-03-Object-functions
index 91dd77667ed..fdb11e63d87 100644
--- a/Build/source/libs/poppler/poppler-PATCHES/patch-03-Object-functions
+++ b/Build/source/libs/poppler/poppler-PATCHES/patch-03-Object-functions
@@ -1,7 +1,7 @@
-diff -ur poppler-0.41.0.orig/poppler/Object.h poppler-0.41.0/poppler/Object.h
---- poppler-0.41.0.orig/poppler/Object.h Mon Nov 16 06:05:22 2015
-+++ poppler-0.41.0/poppler/Object.h Wed Feb 17 15:39:51 2016
-@@ -140,7 +140,7 @@
+diff -ur poppler-src-orig/poppler/Object.h poppler-src/poppler/Object.h
+--- poppler-src-orig/poppler/Object.h 2016-03-02 00:35:28.000000000 +0100
++++ poppler-src/poppler/Object.h 2016-03-17 10:53:37.000000000 +0100
+@@ -147,7 +147,7 @@
Object *initStream(Stream *streamA);
Object *initRef(int numA, int genA)
{ initObj(objRef); ref.num = numA; ref.gen = genA; return this; }
@@ -10,7 +10,7 @@ diff -ur poppler-0.41.0.orig/poppler/Object.h poppler-0.41.0/poppler/Object.h
{ initObj(objCmd); cmd = copyString(cmdA); return this; }
Object *initError()
{ initObj(objError); return this; }
-@@ -186,7 +186,7 @@
+@@ -194,7 +194,7 @@
GBool isName(const char *nameA)
{ return type == objName && !strcmp(name, nameA); }
GBool isDict(const char *dictType);
@@ -19,7 +19,7 @@ diff -ur poppler-0.41.0.orig/poppler/Object.h poppler-0.41.0/poppler/Object.h
GBool isCmd(const char *cmdA)
{ return type == objCmd && !strcmp(cmd, cmdA); }
-@@ -233,7 +233,7 @@
+@@ -243,7 +243,7 @@
Object *dictGetValNF(int i, Object *obj);
// Stream accessors.
@@ -28,7 +28,7 @@ diff -ur poppler-0.41.0.orig/poppler/Object.h poppler-0.41.0/poppler/Object.h
void streamReset();
void streamClose();
int streamGetChar();
-@@ -337,10 +337,10 @@
+@@ -347,10 +347,10 @@
#include "Stream.h"
diff --git a/Build/source/libs/poppler/poppler-src/CMakeLists.txt b/Build/source/libs/poppler/poppler-src/CMakeLists.txt
index d30fa4b1c73..d385893280b 100644
--- a/Build/source/libs/poppler/poppler-src/CMakeLists.txt
+++ b/Build/source/libs/poppler/poppler-src/CMakeLists.txt
@@ -22,7 +22,7 @@ if (ECM_FOUND)
endif()
set(POPPLER_MAJOR_VERSION "0")
-set(POPPLER_MINOR_VERSION "41")
+set(POPPLER_MINOR_VERSION "42")
set(POPPLER_MICRO_VERSION "0")
set(POPPLER_VERSION "${POPPLER_MAJOR_VERSION}.${POPPLER_MINOR_VERSION}.${POPPLER_MICRO_VERSION}")
@@ -38,7 +38,8 @@ option(ENABLE_CPP "Compile poppler cpp wrapper." ON)
set(ENABLE_LIBOPENJPEG "auto" CACHE STRING "Use libopenjpeg for JPX streams. Possible values: auto, openjpeg1, openjpeg2. 'auto' prefers openjpeg1 over openjpeg2 if both are available. Unset to not use openjpeg.")
set(ENABLE_CMS "auto" CACHE STRING "Use color management system. Possible values: auto, lcms1, lcms2. 'auto' prefers lcms2 over lcms1 if both are available. Unset to disable color management system.")
option(ENABLE_LIBCURL "Build libcurl based HTTP support." OFF)
-option(ENABLE_ZLIB "Build with zlib (not totally safe)." OFF)
+option(ENABLE_ZLIB "Build with zlib." ON)
+option(ENABLE_ZLIB_UNCOMPRESS "Use zlib to uncompress flate streams (not totally safe)." OFF)
option(SPLASH_CMYK "Include support for CMYK rasterization." OFF)
option(USE_FIXEDPOINT "Use fixed point arithmetic in the Splash backend" OFF)
option(USE_FLOAT "Use single precision arithmetic in the Splash backend" OFF)
@@ -105,6 +106,7 @@ endif(WITH_FONTCONFIGURATION_FONTCONFIG)
macro_optional_find_package(JPEG)
macro_optional_find_package(PNG)
macro_optional_find_package(TIFF)
+macro_optional_find_package(NSS3)
if(JPEG_FOUND)
set(ENABLE_LIBJPEG ${JPEG_FOUND})
endif(JPEG_FOUND)
@@ -158,6 +160,10 @@ if(ENABLE_ZLIB)
endif(ZLIB_FOUND)
set(ENABLE_ZLIB ${ZLIB_FOUND})
endif(ENABLE_ZLIB)
+if(ENABLE_ZLIB_UNCOMPRESS AND NOT ENABLE_ZLIB)
+ message("Warning: ENABLE_ZLIB_UNCOMPRESS requires ENABLE_ZLIB")
+ set(ENABLE_ZLIB_UNCOMPRESS FALSE)
+endif(ENABLE_ZLIB_UNCOMPRESS AND NOT ENABLE_ZLIB)
set(USE_OPENJPEG1 FALSE)
set(USE_OPENJPEG2 FALSE)
set(WITH_OPENJPEG FALSE)
@@ -234,6 +240,11 @@ endif(CMAKE_USE_PTHREADS_INIT)
if(ENABLE_ZLIB)
include_directories(${ZLIB_INCLUDE_DIR})
endif(ENABLE_ZLIB)
+
+if (NSS3_FOUND)
+ add_definitions(${NSS3_CFLAGS})
+ set(ENABLE_NSS3 ON)
+endif(NSS3_FOUND)
if(JPEG_FOUND)
include_directories(${JPEG_INCLUDE_DIR})
set(ENABLE_LIBJPEG ON)
@@ -364,6 +375,7 @@ set(poppler_SRCS
poppler/ProfileData.cc
poppler/PreScanOutputDev.cc
poppler/PSTokenizer.cc
+ poppler/SignatureInfo.cc
poppler/Stream.cc
poppler/StructTreeRoot.cc
poppler/StructElement.cc
@@ -412,6 +424,7 @@ endif(ENABLE_SPLASH)
if(FONTCONFIG_FOUND)
set(poppler_LIBS ${poppler_LIBS} ${FONTCONFIG_LIBRARIES})
endif(FONTCONFIG_FOUND)
+
if(JPEG_FOUND)
set(poppler_SRCS ${poppler_SRCS}
poppler/DCTStream.cc
@@ -420,10 +433,15 @@ if(JPEG_FOUND)
endif(JPEG_FOUND)
if(ENABLE_ZLIB)
set(poppler_SRCS ${poppler_SRCS}
- poppler/FlateStream.cc
+ poppler/FlateEncoder.cc
)
set(poppler_LIBS ${poppler_LIBS} ${ZLIB_LIBRARIES})
endif(ENABLE_ZLIB)
+if(ENABLE_ZLIB_UNCOMPRESS)
+ set(poppler_SRCS ${poppler_SRCS}
+ poppler/FlateStream.cc
+ )
+endif(ENABLE_ZLIB_UNCOMPRESS)
if(ENABLE_LIBCURL)
set(poppler_SRCS ${poppler_SRCS}
poppler/CurlCachedFile.cc
@@ -431,6 +449,12 @@ if(ENABLE_LIBCURL)
)
set(poppler_LIBS ${poppler_LIBS} ${CURL_LIBRARIES})
endif(ENABLE_LIBCURL)
+if (ENABLE_NSS3)
+ set(poppler_SRCS ${poppler_SRCS}
+ poppler/SignatureHandler.cc
+ )
+ set(poppler_LIBS ${poppler_LIBS} ${NSS3_LIBRARIES})
+endif(ENABLE_NSS3)
if(LIBOPENJPEG_FOUND)
set(poppler_SRCS ${poppler_SRCS}
poppler/JPEG2000Stream.cc
@@ -477,7 +501,7 @@ add_library(poppler STATIC ${poppler_SRCS})
else(MSVC)
add_library(poppler SHARED ${poppler_SRCS})
endif(MSVC)
-set_target_properties(poppler PROPERTIES VERSION 58.0.0 SOVERSION 58)
+set_target_properties(poppler PROPERTIES VERSION 59.0.0 SOVERSION 59)
target_link_libraries(poppler LINK_PRIVATE ${poppler_LIBS})
install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX})
@@ -716,7 +740,9 @@ show_end_message("use gtk-doc" "not supported with this CMake build system")
show_end_message_yesno("use libjpeg" ENABLE_LIBJPEG)
show_end_message_yesno("use libpng" ENABLE_LIBPNG)
show_end_message_yesno("use libtiff" ENABLE_LIBTIFF)
-show_end_message_yesno("use zlib" ENABLE_ZLIB)
+show_end_message_yesno("use zlib compress" ENABLE_ZLIB)
+show_end_message_yesno("use zlib uncompress" ENABLE_ZLIB_UNCOMPRESS)
+show_end_message_yesno("use nss3" ENABLE_NSS3)
show_end_message_yesno("use curl" ENABLE_LIBCURL)
show_end_message_yesno("use libopenjpeg" WITH_OPENJPEG)
if(USE_OPENJPEG1)
@@ -747,9 +773,9 @@ if(NOT ENABLE_LIBJPEG)
message("Warning: Using libjpeg is recommended. The internal DCT decoder is unmaintained.")
endif(NOT ENABLE_LIBJPEG)
-if(ENABLE_ZLIB)
+if(ENABLE_ZLIB_UNCOMPRESS)
message("Warning: Using zlib is not totally safe")
-endif(ENABLE_ZLIB)
+endif(ENABLE_ZLIB_UNCOMPRESS)
if(NOT WITH_OPENJPEG)
message("Warning: Using libopenjpeg is recommended. The internal JPX decoder is unmaintained.")
diff --git a/Build/source/libs/poppler/poppler-src/ChangeLog b/Build/source/libs/poppler/poppler-src/ChangeLog
index b1785bebd13..482e269b19f 100644
--- a/Build/source/libs/poppler/poppler-src/ChangeLog
+++ b/Build/source/libs/poppler/poppler-src/ChangeLog
@@ -1,3 +1,364 @@
+commit ef21f651a4af801502d6b4b4f7258d54f14e7aea
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Wed Mar 16 20:23:39 2016 +0100
+
+ Some (C) updating
+
+ poppler/FlateStream.cc | 1 +
+ poppler/Gfx.cc | 2 +-
+ poppler/PSOutputDev.cc | 2 +-
+ poppler/SignatureHandler.cc | 2 +-
+ poppler/SplashOutputDev.cc | 2 +-
+ poppler/SplashOutputDev.h | 2 +-
+ poppler/Stream.cc | 2 +-
+ poppler/Stream.h | 2 +-
+ poppler/TextOutputDev.cc | 2 +-
+ poppler/TextOutputDev.h | 2 +-
+ 10 files changed, 10 insertions(+), 9 deletions(-)
+
+commit 57b7a52cc6b3675bfbff29ef20a509eadce091ac
+Author: Thomas Freitag <Thomas.Freitag@alfa.de>
+Date: Wed Mar 16 10:36:22 2016 +0100
+
+ Fix rendering of some broken PDF files
+
+ Call constructXRef if necessary xref can't be fetched and the PDF
+ don't use xref streams
+
+ Bug #92508
+
+ poppler/XRef.cc | 8 +++++++-
+ poppler/XRef.h | 3 ++-
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+
+commit 04f3448d73ff7a3a2f1bf885aea64e96cc29a69d
+Author: Thomas Freitag <Thomas.Freitag@alfa.de>
+Date: Wed Mar 16 00:58:35 2016 +0100
+
+ Initialize gamut mapping multipliers in ::copy() functions
+
+ Bug #90697
+
+ poppler/GfxState.cc | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+commit 69ffeb71a79b686d5c79d20832c4666c498098e8
+Author: Alok Anand <alok4nand@gmail.com>
+Date: Mon Mar 14 20:18:32 2016 +0100
+
+ Add the support for version 5 + revision 6 documents.
+
+ Bug #85368
+
+ poppler/Decrypt.cc | 357
+ ++++++++++++++++++++++++++++++++++++++++++++-
+ poppler/SecurityHandler.cc | 9 +-
+ 2 files changed, 358 insertions(+), 8 deletions(-)
+
+commit 2dcfefb43c0d4ca86a4f4b2d019882e134201b27
+Author: Thomas Freitag <Thomas.Freitag@alfa.de>
+Date: Sat Mar 12 03:52:01 2016 +0100
+
+ handle SMaskInData = 0 for JPX encoded images
+
+ Bug #93468
+
+ poppler/JPEG2000Stream.cc | 77
+ +++++++++++++++++++++++++++++++++++++----------
+ 1 file changed, 61 insertions(+), 16 deletions(-)
+
+commit e58d310c1802b77a6356ec0d3d0180a2a1605b41
+Author: Thomas Freitag <Thomas.Freitag@alfa.de>
+Date: Thu Mar 10 12:05:28 2016 +0100
+
+ Implement function shading in splash
+
+ Bug #94441
+
+ poppler/SplashOutputDev.cc | 117
+ +++++++++++++++++++++++++++++++++++++++++++++
+ poppler/SplashOutputDev.h | 31 +++++++++++-
+ 2 files changed, 147 insertions(+), 1 deletion(-)
+
+commit 09e2ae234179c42ccf06b040a0f6c89d65d69713
+Author: Thomas Freitag <Thomas.Freitag@alfa.de>
+Date: Tue Mar 8 23:08:53 2016 +0100
+
+ assure line width > 0 in case of text stroke
+
+ Bug #94038
+
+ poppler/SplashOutputDev.cc | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+commit 37c7469955d465e006d74eecebb766eb8513bbf3
+Author: Thomas Freitag <Thomas.Freitag@alfa.de>
+Date: Mon Mar 7 20:23:11 2016 +0100
+
+ JPXStream: Don't scale image comps to 8 bits in case of an indexed
+ colorspace
+
+ Followup of bug #94371
+
+ poppler/JPEG2000Stream.cc | 58
+ +++++++++++++++++++++++++++++++----------------
+ 1 file changed, 38 insertions(+), 20 deletions(-)
+
+commit d4e24e5754f5a0bf335ddf83747d0dc85b7c409f
+Author: Thomas Freitag <Thomas.Freitag@alfa.de>
+Date: Sun Mar 6 22:46:23 2016 +0100
+
+ implement jpx streams with depth < 8
+
+ Bug #94371
+
+ poppler/JPEG2000Stream.cc | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+commit 5f79b6485b107fb0939563837046fea6b4b89fdc
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Thu Mar 3 00:45:34 2016 +0100
+
+ (C) here too
+
+ qt5/src/poppler-link.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit a80a036269eb18daf0ec69c23a8bc71fb4852acb
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Thu Mar 3 00:44:27 2016 +0100
+
+ Qt: Only check the link page for local links
+
+ qt4/src/poppler-link.cc | 32 +++++++++++++++++---------------
+ qt5/src/poppler-link.cc | 28 +++++++++++++++-------------
+ 2 files changed, 32 insertions(+), 28 deletions(-)
+
+commit a3c7f6184d1be3f2737086cf650f4012075515f8
+Author: Adrián Pérez de Castro <aperez@igalia.com>
+Date: Wed Mar 2 11:58:24 2016 +0200
+
+ Tagged-PDF: Document new pdfinfo flags in its manual page
+
+ https://bugs.freedesktop.org/show_bug.cgi?id=64816
+
+ utils/pdfinfo.1 | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+commit 7cf52e56677e11b15d610017bccd0cc3f74badaf
+Author: Emmanuele Bassi <ebassi@gnome.org>
+Date: Wed Mar 2 04:38:52 2016 +0000
+
+ Use correct includes for NSPR/NSS headers
+
+ The header files provided by NSS3 are inside versioned directories,
+ `$includedir/nss3` and `$includedir/nspr4`, which are provided by the
+ nss3 pkg-config file as include directives for the compiler.
+
+ We can also use nspr.h as a single entry point, to avoid cherry
+ picking
+ specific headers.
+
+ https://bugzilla.freedesktop.org/show_bug.cgi?id=94360
+
+ poppler/SignatureHandler.cc | 2 +-
+ poppler/SignatureHandler.h | 22 +++++++++-------------
+ 2 files changed, 10 insertions(+), 14 deletions(-)
+
+commit 1f7cb78f8b771bae8bfd96a7a7ca3afbaf89c749
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Wed Mar 2 09:51:46 2016 +0100
+
+ Fix memory leak in Matte parsing
+
+ Also remove unneeded comment
+
+ poppler/Gfx.cc | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+commit 36c276f1af7e0f1d8a207f6cdcaa80a24e95e044
+Author: Thomas Freitag <Thomas.Freitag@alfa.de>
+Date: Wed Mar 2 09:50:01 2016 +0100
+
+ Splash: Implementation of matte entries in softmasks of softmasked
+ images
+
+ Bug #22473
+
+ poppler/Gfx.cc | 30 +++++++++++++++--
+ poppler/GfxState.cc | 7 ++--
+ poppler/GfxState.h | 7 +++-
+ poppler/SplashOutputDev.cc | 80
+ +++++++++++++++++++++++++++++++++++++++++++++-
+ poppler/SplashOutputDev.h | 3 +-
+ 5 files changed, 120 insertions(+), 7 deletions(-)
+
+commit 810605dae2d7f239ce29640a31a9befe511c3190
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Wed Mar 2 00:49:00 2016 +0100
+
+ Compile++
+
+ poppler/Form.cc | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+commit 9d33825e6f6167f07b2739645b93249b2bc043da
+Merge: a8853b1 f3e3ebe
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Wed Mar 2 00:37:11 2016 +0100
+
+ Merge remote-tracking branch 'origin/signatureHandling'
+
+commit f3e3ebe51483050cfdf8773dbd0d6646521f17cb
+Author: André Guerreiro <aguerreiro1985@gmail.com>
+Date: Wed Mar 2 00:35:05 2016 +0100
+
+ Load NSS root certs module
+
+ This change is needed to actually do certificate validation, because
+ as it is NSS is trying to load the module which contains all the
+ builtin root certs from the Firefox profile directory where it is
+ usually missing. This way it will load the module from a system
+ library directory.
+
+ poppler/SignatureHandler.cc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+commit a8853b1df0a15570dff6ecc333769257bbf874c3
+Author: Adrian Perez de Castro <aperez@igalia.com>
+Date: Thu May 9 19:11:26 2013 +0300
+
+ Tagged-PDF: Modify pdfinfo to show the document structure
+
+ https://bugs.freedesktop.org/show_bug.cgi?id=64816
+
+ utils/pdfinfo.cc | 96
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 96 insertions(+)
+
+commit 1bf0ffdf1c68019515349262a14425c78c90ea18
+Author: Adrian Johnson <ajohnson@redneon.com>
+Date: Thu Feb 25 22:52:32 2016 +1030
+
+ Add missing files that got dropped from the previous commit
+ (989ceb6bd90)
+
+ poppler/FlateEncoder.cc | 148
+ ++++++++++++++++++++++++++++++++++++++++++++++++
+ poppler/FlateEncoder.h | 73 ++++++++++++++++++++++++
+ 2 files changed, 221 insertions(+)
+
+commit 989ceb6bd90cc8a79dd48c58183f1855de269c9b
+Author: William Bader <william@newspapersystems.com>
+Date: Thu Feb 25 21:01:16 2016 +1030
+
+ Add support for Flate compression in Level 3 PostScript output.
+
+ The changes to the build variables are from Adrian Johnson's
+ DeflateStream
+ patches at https://bugs.freedesktop.org/attachment.cgi?id=89776
+
+ CMakeLists.txt | 21 ++++++--
+ config.h.cmake | 5 +-
+ configure.ac | 97 +++++++++++++++++++++--------------
+ poppler/FlateStream.cc | 14 +++++
+ poppler/Makefile.am | 13 ++++-
+ poppler/PSOutputDev.cc | 122
+ +++++++++++++++++++++++++++++---------------
+ poppler/PSOutputDev.h | 10 +++-
+ poppler/Stream.cc | 4 +-
+ poppler/Stream.h | 2 +-
+ poppler/poppler-config.h.in | 6 +--
+ 10 files changed, 202 insertions(+), 92 deletions(-)
+
+commit 91c0be60f3e7a53373ba660702358cf52f74d1b2
+Author: William Bader <william@newspapersystems.com>
+Date: Thu Feb 25 20:50:10 2016 +1030
+
+ xpdf304: Merge xpdf-3.04 support for LZW encoding in PSOutputDev
+ and Stream.
+
+ Level 2 and Level 3 PostScript now use LZW encoding instead of Run
+ Length encoding, which can make some images one tenth the size.
+ PSOutputDev provides setEnableLZW() and getEnableLZW() to control
+ support for LZW encoding.
+
+ poppler/PSOutputDev.cc | 164
+ ++++++++++++++++++++++++++++++++++---------------
+ poppler/PSOutputDev.h | 3 +
+ poppler/Stream.cc | 145 +++++++++++++++++++++++++++++++++++++++++++
+ poppler/Stream.h | 38 ++++++++++++
+ 4 files changed, 301 insertions(+), 49 deletions(-)
+
+commit b88e68f9c84d987a814716aab50543bf8a5cb8f8
+Author: William Bader <william@newspapersystems.com>
+Date: Thu Feb 25 20:41:48 2016 +1030
+
+ xpdf304: Merge change from poppler/Gfx.cc to avoid attempting a
+ tiling pattern fill
+
+ with a singular transform matrix (abs(determinant) < 0.000001).
+
+ poppler/Gfx.cc | 21 ++++++++++++++++++---
+ 1 file changed, 18 insertions(+), 3 deletions(-)
+
+commit 3f5f0796d855cb8b8c3a038484d4ca7c6f1a55f2
+Author: Jason Crain <jason@aquaticape.us>
+Date: Fri Feb 19 10:54:29 2016 -0600
+
+ Cache result of inner loop in visitDepthFirst
+
+ Speeds up sorting of text blocks.
+
+ bug #77087
+
+ poppler/TextOutputDev.cc | 42 ++++++++++++++++++++++++++++++++++--------
+ poppler/TextOutputDev.h | 4 ++++
+ 2 files changed, 38 insertions(+), 8 deletions(-)
+
+commit 448169bd96137e2bf0145783012276220bb0c51a
+Author: Thomas Freitag <Thomas.Freitag@alfa.de>
+Date: Wed Feb 17 23:02:53 2016 +0100
+
+ Fall back to Gfx implementation of tiling pattern if repetition rate
+ is small
+
+ Bug #90596
+
+ poppler/SplashOutputDev.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 23e4291f2545f56432b0a9c4d709048825327bc2
+Author: Thomas Freitag <Thomas.Freitag@alfa.de>
+Date: Wed Feb 17 22:59:30 2016 +0100
+
+ Check if PDF knows the witdh of 'm' in case of substituted font
+
+ To check wether the PDF font declaration includes the width of
+ the letter 'm', compare it with the width of code 0. Code 0 is the
+ replacement glyph in a font and has the width of a blank. The width
+ table is initialized with this value, and the blank is always smaller
+ than a 'm'.
+
+ Bug #94054
+
+ poppler/SplashOutputDev.cc | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+commit 88415426df363f1ef86b741cbc3587a89d31aa1f
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Wed Feb 17 00:11:49 2016 +0100
+
+ 0.41.0
+
+ CMakeLists.txt | 2 +-
+ NEWS | 9 +++++++++
+ configure.ac | 2 +-
+ cpp/Doxyfile | 2 +-
+ qt4/src/Doxyfile | 2 +-
+ qt5/src/Doxyfile | 2 +-
+ 6 files changed, 14 insertions(+), 5 deletions(-)
+
commit 5689c990a187108ddc0a88b9825ba3bea644368f
Author: Thomas Freitag <Thomas.Freitag@alfa.de>
Date: Tue Feb 16 01:44:31 2016 +0100
@@ -104,6 +465,35 @@ Date: Mon Jan 11 19:26:02 2016 +1030
utils/pdftocairo.cc | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
+commit dcefd7a232ba17af878b95efaa4ffaf147d095b7
+Author: Adrian Johnson <ajohnson@redneon.com>
+Date: Fri Jan 8 16:49:25 2016 +1030
+
+ check all byte ranges in signature dictionary
+
+ poppler/Form.cc | 60
+ +++++++++++++++++++++++++++++---------------------------
+ poppler/Object.h | 12 +++++++++++-
+ 2 files changed, 42 insertions(+), 30 deletions(-)
+
+commit e5104973197c63c3a46e6d2c0f41c9de111d4686
+Author: André Guerreiro <aguerreiro1985@gmail.com>
+Date: Fri Jan 8 17:02:35 2016 +1030
+
+ Improve robustness of SignatureHandler::validateCertificate
+
+ poppler/SignatureHandler.cc | 18 +++++++-----------
+ 1 file changed, 7 insertions(+), 11 deletions(-)
+
+commit 4b0f6e5ec04058d12fbf7537c80b662cbea931b9
+Author: Markus Kilås <digital@markuspage.com>
+Date: Wed Jan 6 23:36:17 2016 +0100
+
+ Fix printf for unsigned int
+
+ utils/pdfsig.cc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
commit 01d4bb222d63eda7dc5ec903c0735179edf77c0e
Author: Albert Astals Cid <aacid@kde.org>
Date: Sun Jan 3 13:01:31 2016 +0100
@@ -587,6 +977,44 @@ Date: Sat Oct 31 18:32:49 2015 +1030
utils/pdftocairo.cc | 42 ++++++++++++++++++++----------------------
1 file changed, 20 insertions(+), 22 deletions(-)
+commit 8859cebef5bb5308757505c8f2c8ca9fc12e154d
+Author: Adrian Johnson <ajohnson@redneon.com>
+Date: Sat Oct 31 08:04:51 2015 +1030
+
+ gitignore
+
+ utils/.gitignore | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 946eb417e6da11491f6409669119254c769b6945
+Author: Adrian Johnson <ajohnson@redneon.com>
+Date: Thu Oct 29 21:59:06 2015 +1030
+
+ man pages: remove final comma in see also list
+
+ utils/pdfdetach.1 | 2 +-
+ utils/pdffonts.1 | 2 +-
+ utils/pdfimages.1 | 2 +-
+ utils/pdfinfo.1 | 2 +-
+ utils/pdfseparate.1 | 2 +-
+ utils/pdfsig.1 | 2 +-
+ utils/pdftocairo.1 | 2 +-
+ utils/pdftohtml.1 | 2 +-
+ utils/pdftoppm.1 | 2 +-
+ utils/pdftops.1 | 2 +-
+ utils/pdftotext.1 | 2 +-
+ utils/pdfunite.1 | 2 +-
+ 12 files changed, 12 insertions(+), 12 deletions(-)
+
+commit 1c66076bac768774e8b2b514bc0c555bc0395348
+Author: André Guerreiro <aguerreiro1985@gmail.com>
+Date: Thu Oct 29 21:55:46 2015 +1030
+
+ pdfsig: update man page
+
+ utils/pdfsig.1 | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
commit 3167964d70647d7b04e3ef8f415d5935990ecc9a
Author: Thomas Freitag <Thomas.Freitag@alfa.de>
Date: Wed Oct 28 23:13:44 2015 +0100
@@ -605,6 +1033,80 @@ Date: Wed Oct 28 23:13:44 2015 +0100
splash/SplashState.h | 5 ++++-
8 files changed, 46 insertions(+), 6 deletions(-)
+commit 298caa2fc52cf50e92e1afda39b77b11f2de9743
+Author: Adrian Johnson <ajohnson@redneon.com>
+Date: Wed Oct 28 20:54:43 2015 +1030
+
+ Add pdfsig reference (and other missing utils) to man pages
+
+ utils/pdfdetach.1 | 5 ++++-
+ utils/pdffonts.1 | 3 +++
+ utils/pdfimages.1 | 5 ++++-
+ utils/pdfinfo.1 | 3 +++
+ utils/pdfseparate.1 | 10 ++++++++++
+ utils/pdftocairo.1 | 3 +++
+ utils/pdftohtml.1 | 3 +++
+ utils/pdftoppm.1 | 3 +++
+ utils/pdftops.1 | 3 +++
+ utils/pdftotext.1 | 5 ++++-
+ utils/pdfunite.1 | 10 ++++++++++
+ 11 files changed, 50 insertions(+), 3 deletions(-)
+
+commit 5a6d6f5ec8782bb69a5805d8d8379a33aa00edec
+Author: Adrian Johnson <ajohnson@redneon.com>
+Date: Wed Oct 28 20:54:23 2015 +1030
+
+ Add pdfsig man page
+
+ utils/pdfsig.1 | 46 ++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 46 insertions(+)
+
+commit 1f8e1a029773cefe0c31357c1e450cc4ecd5a5b5
+Author: Adrian Johnson <ajohnson@redneon.com>
+Date: Wed Oct 28 19:38:14 2015 +1030
+
+ pdfsig: rename -c to -nocert
+
+ and make help options consistent with other tools (add -? and list
+ help options last)
+
+ utils/pdfsig.cc | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+commit 9d5bf425bd82dda303362380c488559be0007d78
+Author: Adrian Johnson <ajohnson@redneon.com>
+Date: Wed Oct 28 19:34:26 2015 +1030
+
+ rename pdfsigverify to pdfsig
+
+ utils/CMakeLists.txt | 12 ++--
+ utils/Makefile.am | 6 +-
+ utils/pdfsig.cc | 173
+ ++++++++++++++++++++++++++++++++++++++++++++++++++
+ utils/pdfsigverify.cc | 173
+ --------------------------------------------------
+ 4 files changed, 182 insertions(+), 182 deletions(-)
+
+commit 1d97f708ceb7cd34ccdb1a4f85192efe83d1853c
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Tue Oct 27 22:27:31 2015 +0100
+
+ Differentiate between unknown and untrusted issuer
+
+ poppler/SignatureHandler.cc | 4 +++-
+ poppler/SignatureInfo.h | 4 +++-
+ utils/pdfsigverify.cc | 7 +++++--
+ 3 files changed, 11 insertions(+), 4 deletions(-)
+
+commit 19e20dc69a631f92bf4fdc0be0dd840a460cfc92
+Author: Markus Kilås <digital@markuspage.com>
+Date: Tue Oct 27 22:23:06 2015 +0100
+
+ Handle untrusted issuer
+
+ poppler/SignatureHandler.cc | 2 ++
+ 1 file changed, 2 insertions(+)
+
commit c20f68ce434366bbec4077824da97ce843ecdff3
Author: Marek Kasik <mkasik@redhat.com>
Date: Thu Oct 22 16:15:23 2015 +0200
@@ -631,6 +1133,19 @@ Date: Fri Oct 23 10:15:47 2015 +0200
poppler/CharCodeToUnicode.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
+commit 02d3564faa5d8174ed93ce66fcda975b1a898ec5
+Author: André Guerreiro <aguerreiro1985@gmail.com>
+Date: Wed Oct 14 22:50:05 2015 +0200
+
+ Incremental hashing + large file support for digital signatures
+
+ poppler/Form.cc | 63
+ +++++++++++++++++++++++++++++++++------------
+ poppler/Form.h | 1 +
+ poppler/SignatureHandler.cc | 34 ++++++++++++++----------
+ poppler/SignatureHandler.h | 9 +++++--
+ 4 files changed, 76 insertions(+), 31 deletions(-)
+
commit fb906dca8b84d03267099cc3174c50e932a55236
Author: Adrian Johnson <ajohnson@redneon.com>
Date: Thu Oct 15 07:19:16 2015 +1030
@@ -679,6 +1194,31 @@ Date: Fri Oct 9 23:28:03 2015 +0200
qt5/src/Makefile.am | 2 +-
12 files changed, 36 insertions(+), 19 deletions(-)
+commit 5570c70a20ae62a9b3341372fafc64e916774adb
+Author: André Guerreiro <aguerreiro1985@gmail.com>
+Date: Mon Oct 5 16:50:30 2015 +0200
+
+ NSS conditional build
+
+ CMakeLists.txt | 19 ++++++++++++++-----
+ config.h.cmake | 3 +++
+ configure.ac | 20 +++++++++++++++++++-
+ poppler/Form.cc | 7 ++++++-
+ poppler/Makefile.am | 28 ++++++++++++++++++++++------
+ utils/CMakeLists.txt | 16 +++++++++-------
+ utils/Makefile.am | 5 ++++-
+ 7 files changed, 77 insertions(+), 21 deletions(-)
+
+commit c7c0207b1cfe49a4353d6cda93dbebef4508138f
+Author: André Guerreiro <aguerreiro1985@gmail.com>
+Date: Mon Oct 5 15:57:04 2015 +0200
+
+ Support for adbe.pkcs7.sha1 signatures
+
+ poppler/Form.cc | 2 +-
+ poppler/SignatureHandler.cc | 27 +++++++++++++++++++++++++--
+ 2 files changed, 26 insertions(+), 3 deletions(-)
+
commit e8cb16bff48dbe2d9efd988ddb09608406d2633b
Author: Adrian Johnson <ajohnson@redneon.com>
Date: Sun Sep 27 15:34:12 2015 +0930
@@ -781,6 +1321,15 @@ Date: Fri Sep 25 00:30:58 2015 +0200
poppler/Annot.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
+commit 4f7903ebc037c63683637973285bc34ea83542dc
+Author: André Guerreiro <aguerreiro1985@gmail.com>
+Date: Thu Sep 24 23:57:46 2015 +0200
+
+ Fix for Buffer overflow
+
+ poppler/Form.cc | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
commit 9aa19159bff4db02889cba48b9b31e40247e5314
Author: Even Rouault <even.rouault@spatialys.com>
Date: Fri Sep 11 13:56:05 2015 +0200
@@ -837,6 +1386,214 @@ Date: Tue Sep 15 14:43:21 2015 -0500
poppler/CairoOutputDev.cc | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
+commit 10693fb236ff92c6aa0c0a9f762362d2fd9ea738
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 20:19:00 2015 +0200
+
+ include shuffling
+
+ poppler/PDFDoc.cc | 2 --
+ poppler/PDFDoc.h | 3 ---
+ poppler/SignatureHandler.cc | 1 -
+ utils/pdfsigverify.cc | 1 +
+ 4 files changed, 1 insertion(+), 6 deletions(-)
+
+commit 6e24d374987fbba0f5a133d73dfcb3e73129b534
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 19:59:09 2015 +0200
+
+ Simplify biterange handling
+
+ poppler/Form.cc | 22 +++++++---------------
+ poppler/Form.h | 2 +-
+ 2 files changed, 8 insertions(+), 16 deletions(-)
+
+commit 7afa26fc389f4b2aa67cdf286e9c4ebfb3d78de5
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 19:50:56 2015 +0200
+
+ Disable SignatureInfo and SignatureHandler copy ctr and assignment
+ operator
+
+ poppler/SignatureHandler.h | 3 +++
+ poppler/SignatureInfo.h | 3 +++
+ 2 files changed, 6 insertions(+)
+
+commit 5348f8d080ae9f0ee58d75fd7ae2bc9f23692eca
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 19:46:23 2015 +0200
+
+ Fix some leaks in SignatureHandler
+
+ poppler/SignatureHandler.cc | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+commit 17b3a8dc2f8ab50696dd1247c4b6dd75991ab17e
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 19:40:30 2015 +0200
+
+ Signatures: keep Goostring and convert to uchar when needed
+
+ poppler/Form.cc | 11 ++++++-----
+ poppler/Form.h | 5 ++---
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+commit a4ac855435325225e3d89d83870ff08ec73d86f8
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 01:52:41 2015 +0200
+
+ PDFDoc::getSignatureWidgets: Do not assume a given page exists
+
+ poppler/PDFDoc.cc | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+commit 6509068cf6e4a92359bcc5402f9e9eb9649d641c
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 01:45:47 2015 +0200
+
+ SignatureHandler initialize members on constructor
+
+ poppler/SignatureHandler.cc | 4 ++++
+ poppler/SignatureHandler.h | 8 ++++----
+ 2 files changed, 8 insertions(+), 4 deletions(-)
+
+commit 5d8dfaa9d55932cde638880bcee063a6f084689f
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 01:43:16 2015 +0200
+
+ SignatureInfo::setSignerName: free old signer_name
+
+ poppler/SignatureInfo.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit f284cfc7394175ea675d7c76d97a1f8461cf17d2
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 01:42:11 2015 +0200
+
+ Start function names on lowercase
+
+ poppler/Form.cc | 4 ++--
+ poppler/SignatureHandler.cc | 5 +++--
+ poppler/SignatureHandler.h | 5 +++--
+ 3 files changed, 8 insertions(+), 6 deletions(-)
+
+commit 127ad3bb038d90ad7579e2e94cff2890869e2f43
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 01:40:31 2015 +0200
+
+ FormFieldSignature::parseInfo: check for isString instead !isNull
+
+ poppler/Form.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit e428a3b8449830bf00706b4ccf86c27a55970f1f
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 01:39:57 2015 +0200
+
+ FormFieldSignature::parseInfo: Use shorter isName version
+
+ poppler/Form.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit ba3a4ec30fcd303e91ef41bef491c230a822bd32
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 01:36:44 2015 +0200
+
+ Delete the signature_info in FormFieldSignature not in pdfsigverify
+
+ poppler/Form.cc | 1 +
+ utils/pdfsigverify.cc | 3 +--
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+commit e6b3d696adea70c79f60a67c275e23c29d2534c3
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 01:33:56 2015 +0200
+
+ Make signature code more resilient
+
+ Do not abort with sign-a-pdf-with-reader-enabled.pdf
+
+ poppler/Form.cc | 68
+ +++++++++++++++++++++++++++++++--------------------------
+ 1 file changed, 37 insertions(+), 31 deletions(-)
+
+commit 23fa84ff91666d1feb2242fe4572eb397c791c55
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 01:28:18 2015 +0200
+
+ cmake: No need if NSS3_FOUND if it's required
+
+ CMakeLists.txt | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+commit 7a1dac27d380f0b1a68383525a4ae4a0c7f3e6f5
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 01:26:31 2015 +0200
+
+ FormFieldSignature::validateSignature: Free to_check earlier
+
+ poppler/Form.cc | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+commit 71cc344d85aba7a4ae79e2c4c454341096a2329b
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 01:25:31 2015 +0200
+
+ Remove PDFDoc::countSignatures
+
+ poppler/PDFDoc.cc | 7 +------
+ poppler/PDFDoc.h | 3 +--
+ utils/pdfsigverify.cc | 9 +++------
+ 3 files changed, 5 insertions(+), 14 deletions(-)
+
+commit c68954dd73202f21b62899dc335fd74218d5b595
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 01:20:41 2015 +0200
+
+ pdfsigverify: move assignment before if
+
+ utils/pdfsigverify.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 8727fe6c08b7326523d6e15c90ce89e5e9d7300e
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Mon Sep 14 01:20:16 2015 +0200
+
+ pdfsigverify: no if before delete
+
+ utils/pdfsigverify.cc | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+commit eb1a6a6254fb393555d6d30b99f4ea800d8d446b
+Author: André Guerreiro <aguerreiro1985@gmail.com>
+Date: Mon Sep 14 01:17:30 2015 +0200
+
+ Core: Support for digital signatures
+
+ Coded with André Esser <bepandre@hotmail.com>
+
+ Bug #16770
+
+ CMakeLists.txt | 9 ++
+ cmake/modules/FindNSS3.cmake | 22 ++++
+ configure.ac | 2 +
+ poppler/DateInfo.cc | 26 ++++
+ poppler/DateInfo.h | 3 +
+ poppler/Form.cc | 116 ++++++++++++++++-
+ poppler/Form.h | 16 +++
+ poppler/Makefile.am | 6 +
+ poppler/PDFDoc.cc | 27 ++++
+ poppler/PDFDoc.h | 9 ++
+ poppler/SignatureHandler.cc | 301
+ +++++++++++++++++++++++++++++++++++++++++++
+ poppler/SignatureHandler.h | 65 ++++++++++
+ poppler/SignatureInfo.cc | 86 +++++++++++++
+ poppler/SignatureInfo.h | 66 ++++++++++
+ utils/CMakeLists.txt | 8 ++
+ utils/Makefile.am | 4 +
+ utils/pdfsigverify.cc | 174 +++++++++++++++++++++++++
+ 17 files changed, 938 insertions(+), 2 deletions(-)
+
commit b14d4b0968f7b0ad783c3fa56ad863d7fda235fe
Author: Albert Astals Cid <aacid@kde.org>
Date: Thu Sep 10 00:33:15 2015 +0200
diff --git a/Build/source/libs/poppler/poppler-src/Makefile.am b/Build/source/libs/poppler/poppler-src/Makefile.am
index 691512f4e3a..9540b6ad321 100644
--- a/Build/source/libs/poppler/poppler-src/Makefile.am
+++ b/Build/source/libs/poppler/poppler-src/Makefile.am
@@ -88,6 +88,7 @@ EXTRA_DIST += \
cmake/modules/FindIconv.cmake \
cmake/modules/FindLCMS.cmake \
cmake/modules/FindLCMS2.cmake \
+ cmake/modules/FindNSS3.cmake \
cmake/modules/FindQt4.cmake \
cmake/modules/GObjectIntrospectionMacros.cmake \
cmake/modules/MacroBoolTo01.cmake \
diff --git a/Build/source/libs/poppler/poppler-src/NEWS b/Build/source/libs/poppler/poppler-src/NEWS
index 22f7e54df2b..19812f9d9c8 100644
--- a/Build/source/libs/poppler/poppler-src/NEWS
+++ b/Build/source/libs/poppler/poppler-src/NEWS
@@ -1,5 +1,33 @@
Release 0.41.0
core:
+ * Add the support for version 5 + revision 6 documents. Bug #85368
+ * Add initial support for Signature handling
+ * Initialize gamut mapping multipliers in ::copy() functions. Bug #90697
+ * Implement jpx streams support with depth < 8
+ * Handle SMaskInData = 0 for JPX encoded images. Bug #93468
+ * Fix rendering of some broken PDF files. Bug #92508
+ * PSOutputDev: Support for LZW encoding
+ * PSOutputDev: Add support for Flate compression in Level 3 output.
+ * SplashOuputDev: Implement function shading. Bug #94441
+ * SplashOuputDev: Improve rendering of some non embedded fonts. Bug #94054
+ * SplashOuputDev: Fall back to Gfx implementation of tiling pattern if repetition rate is small. Bug #90596
+ * SplashOuputDev: Implementation of Matte entries in softmasks of softmasked images. Bug #22473
+ * SplashOuputDev: assure line width > 0 in case of text stroke. Bug #94038
+ * TextOuputDev: Cache result of inner loop in visitDepthFirst. Bug #77087
+ * Avoid attempting a tiling pattern fill with a singular transform matrix
+
+ utils:
+ * pdfinfo: Add option to show document structure
+ * pdfsig: New command that gives information about signature
+
+ qt4:
+ * Fix bug in links to remote documents getting the page number wrong sometimes
+
+ qt5:
+ * Fix bug in links to remote documents getting the page number wrong sometimes
+
+Release 0.41.0
+ core:
* CairoOutputDev: add missing font types (fontCIDType0COT and fontTrueTypeOT). Bug #93559
* SplashOutputDev: Adjust limit check and check in addition bitmap pointer. Bug #94053
diff --git a/Build/source/libs/poppler/poppler-src/config.h.cmake b/Build/source/libs/poppler/poppler-src/config.h.cmake
index 440a13d0dab..85c6d3289ef 100644
--- a/Build/source/libs/poppler/poppler-src/config.h.cmake
+++ b/Build/source/libs/poppler/poppler-src/config.h.cmake
@@ -18,9 +18,15 @@
/* Do not hardcode the library location */
#cmakedefine ENABLE_RELOCATABLE 1
-/* Use zlib instead of builtin zlib decoder. */
+/* Build against zlib. */
#cmakedefine ENABLE_ZLIB 1
+/* Use zlib instead of builtin zlib decoder to uncompress flate streams. */
+#cmakedefine ENABLE_ZLIB_UNCOMPRESS 1
+
+/* Build against libnss3 for digital signature validation */
+#cmakedefine ENABLE_NSS3 1
+
/* Use cairo for rendering. */
#cmakedefine HAVE_CAIRO 1
diff --git a/Build/source/libs/poppler/poppler-src/config.h.in b/Build/source/libs/poppler/poppler-src/config.h.in
index 14c5129fe2d..1933cc8bcfc 100644
--- a/Build/source/libs/poppler/poppler-src/config.h.in
+++ b/Build/source/libs/poppler/poppler-src/config.h.in
@@ -18,12 +18,18 @@
/* Build against libtiff. */
#undef ENABLE_LIBTIFF
+/* Build Poppler against NSS for digital signature support. */
+#undef ENABLE_NSS3
+
/* Do not hardcode the library location */
#undef ENABLE_RELOCATABLE
-/* Use zlib instead of builtin zlib decoder. */
+/* Build against zlib. */
#undef ENABLE_ZLIB
+/* Use zlib instead of builtin zlib decoder to uncompress flate streams. */
+#undef ENABLE_ZLIB_UNCOMPRESS
+
/* Use cairo for rendering. */
#undef HAVE_CAIRO
diff --git a/Build/source/libs/poppler/poppler-src/configure.ac b/Build/source/libs/poppler/poppler-src/configure.ac
index 45575bed9b9..57639ad57e0 100644
--- a/Build/source/libs/poppler/poppler-src/configure.ac
+++ b/Build/source/libs/poppler/poppler-src/configure.ac
@@ -1,5 +1,5 @@
m4_define([poppler_version_major],[0])
-m4_define([poppler_version_minor],[41])
+m4_define([poppler_version_minor],[42])
m4_define([poppler_version_micro],[0])
m4_define([poppler_version],[poppler_version_major.poppler_version_minor.poppler_version_micro])
@@ -264,10 +264,29 @@ else
enable_libopenjpeg=no
fi
+dnl Test for NSS
+AC_ARG_ENABLE(libnss,
+ AC_HELP_STRING([--disable-nss],
+ [Do not build against libnss3.]),
+ enable_libnss=$enableval,
+ enable_libnss="try")
+
+if test x$enable_libnss != xno; then
+ PKG_CHECK_MODULES(NSS3, nss, [enable_nss="yes"],
+ [enable_nss="no"])
+fi
+
+if test x$enable_nss = xyes; then
+ AC_DEFINE(ENABLE_NSS3, 1, [Build against NSS.])
+fi
+
AM_CONDITIONAL(BUILD_LIBOPENJPEG, test x$openjpeg1 = xyes || test x$openjpeg2 = xyes)
AH_TEMPLATE([ENABLE_LIBOPENJPEG],
[Use libopenjpeg instead of builtin jpeg2000 decoder.])
+AM_CONDITIONAL(BUILD_NSS, test x$enable_nss = xyes)
+AH_TEMPLATE([ENABLE_NSS3], [Build Poppler against NSS for digital signature support.])
+
dnl ##### Test for libtiff
AC_ARG_ENABLE(libtiff,
AC_HELP_STRING([--disable-libtiff],
@@ -344,31 +363,53 @@ fi
AC_CHECK_FUNCS(pread64 lseek64)
dnl Test for zlib
-AC_ARG_ENABLE([zlib],
- [AS_HELP_STRING([--enable-zlib],[Build with zlib])],
- [],[enable_zlib="no"])
+AC_ARG_ENABLE(zlib,
+ AC_HELP_STRING([--disable-zlib],
+ [Don't build against zlib.]),
+ enable_zlib=$enableval,
+ enable_zlib="try")
+
+AC_ARG_ENABLE([zlib_uncompress],
+ AS_HELP_STRING([--enable-zlib-uncompress],
+ [Use zlib to uncompress flate streams (not totally safe)]),
+ enable_zlib_uncompress=$enableval,
+ enable_zlib_uncompress="no")
+
if test x$enable_zlib = xyes; then
- AC_CHECK_LIB([z], [inflate],,
- AC_MSG_ERROR("*** zlib library not found ***"))
- AC_CHECK_HEADERS([zlib.h],,
- AC_MSG_ERROR("*** zlib headers not found ***"))
+ AC_CHECK_LIB([z], [inflate],,
+ AC_MSG_ERROR("*** zlib library not found ***"))
+ AC_CHECK_HEADERS([zlib.h],,
+ AC_MSG_ERROR("*** zlib headers not found ***"))
elif test x$enable_zlib = xtry; then
- AC_CHECK_LIB([z], [inflate],
- [enable_zlib="yes"],
- [enable_zlib="no"])
- AC_CHECK_HEADERS([zlib.h],,
- [enable_zlib="no"])
+ AC_CHECK_LIB([z], [inflate],
+ [enable_zlib="yes"],
+ [enable_zlib="no"])
+ AC_CHECK_HEADERS([zlib.h],,
+ [enable_zlib="no"])
fi
if test x$enable_zlib = xyes; then
- ZLIB_LIBS="-lz"
- AC_SUBST(ZLIB_LIBS)
- AC_DEFINE(ENABLE_ZLIB)
+ ZLIB_LIBS="-lz"
+ AC_SUBST(ZLIB_LIBS)
+ AC_DEFINE(ENABLE_ZLIB, 1, [Build against zlib.])
+
+ if test x$enable_zlib_uncompress = xyes; then
+ AC_DEFINE(ENABLE_ZLIB_UNCOMPRESS, 1,
+ [Use zlib instead of builtin zlib decoder to uncompress flate streams.])
+ fi
+else
+ if test x$enable_zlib_uncompress = xyes; then
+ echo " Warning: --enable-zlib-uncompress is incompatible with --disable-zlib."
+ fi
+ enable_zlib_uncompress="no"
fi
AM_CONDITIONAL(BUILD_ZLIB, test x$enable_zlib = xyes)
AH_TEMPLATE([ENABLE_ZLIB],
- [Use zlib instead of builtin zlib decoder.])
+ [Build against zlib.])
+AM_CONDITIONAL(BUILD_ZLIB_UNCOMPRESS, test x$enable_zlib_uncompress = xyes)
+AH_TEMPLATE([ENABLE_ZLIB_UNCOMPRESS],
+ [Use zlib instead of builtin zlib decoder to uncompress flate streams.])
dnl Test for libcurl
AC_ARG_ENABLE(libcurl,
@@ -989,24 +1030,26 @@ poppler-cpp-uninstalled.pc])
echo ""
echo "Building poppler with support for:"
-echo " font configuration: $with_font_configuration"
-echo " splash output: $enable_splash_output"
+echo " font configuration: $with_font_configuration"
+echo " splash output: $enable_splash_output"
if test x$enable_cmyk = xyes;then
echo " with CMYK support"
fi
-echo " cairo output: $use_cairo"
-echo " qt4 wrapper: $enable_poppler_qt4"
-echo " qt5 wrapper: $enable_poppler_qt5"
-echo " glib wrapper: $use_glib"
-echo " introspection: $found_introspection"
-echo " cpp wrapper: $enable_poppler_cpp"
-echo " use gtk-doc: $enable_gtk_doc"
-echo " use libjpeg: $enable_libjpeg"
-echo " use libpng: $enable_libpng"
-echo " use libtiff: $enable_libtiff"
-echo " use zlib: $enable_zlib"
-echo " use libcurl: $enable_libcurl"
-echo " use libopenjpeg: $enable_libopenjpeg"
+echo " cairo output: $use_cairo"
+echo " qt4 wrapper: $enable_poppler_qt4"
+echo " qt5 wrapper: $enable_poppler_qt5"
+echo " glib wrapper: $use_glib"
+echo " introspection: $found_introspection"
+echo " cpp wrapper: $enable_poppler_cpp"
+echo " use gtk-doc: $enable_gtk_doc"
+echo " use libjpeg: $enable_libjpeg"
+echo " use libpng: $enable_libpng"
+echo " use libtiff: $enable_libtiff"
+echo " use zlib compress: $enable_zlib"
+echo " use zlib uncompress: $enable_zlib_uncompress"
+echo " use nss: $enable_nss"
+echo " use libcurl: $enable_libcurl"
+echo " use libopenjpeg: $enable_libopenjpeg"
if test x$enable_libopenjpeg = xyes;then
if test x$openjpeg1 = xyes;then
echo " with openjpeg1"
@@ -1014,7 +1057,7 @@ if test x$enable_libopenjpeg = xyes;then
echo " with openjpeg2"
fi
fi
-echo " use cms: $enable_cms"
+echo " use cms: $enable_cms"
if test x$enable_cms = xyes;then
if test x$lcms1 = xyes;then
echo " with lcms1"
@@ -1023,10 +1066,10 @@ if test x$enable_cms = xyes;then
fi
fi
if test x$enable_build_type != xno;then
- echo " build type: $enable_build_type"
+ echo " build type: $enable_build_type"
fi
-echo " command line utils: $enable_utils"
-echo " test data dir: $TESTDATADIR"
+echo " command line utils: $enable_utils"
+echo " test data dir: $TESTDATADIR"
echo ""
if test x$enable_splash_output = xno -a x$enable_cairo_output = xno; then
@@ -1041,8 +1084,8 @@ if test x$enable_libjpeg != xyes; then
echo " Warning: Using libjpeg is recommended. The internal DCT decoder is unmaintained."
fi
-if test x$enable_zlib != xno; then
- echo " Warning: Using zlib is not totally safe"
+if test x$enable_zlib_uncompress != xno; then
+ echo " Warning: Using zlib for decompression is not totally safe"
fi
if test x$enable_libopenjpeg != xyes; then
diff --git a/Build/source/libs/poppler/poppler-src/poppler/DateInfo.cc b/Build/source/libs/poppler/poppler-src/poppler/DateInfo.cc
index 563204a1743..8cd4883d304 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/DateInfo.cc
+++ b/Build/source/libs/poppler/poppler-src/poppler/DateInfo.cc
@@ -4,6 +4,8 @@
//
// Copyright (C) 2008 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
+// Copyright (C) 2015 André Guerreiro <aguerreiro1985@gmail.com>
+// Copyright (C) 2015 André Esser <bepandre@hotmail.com>
//
// 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
@@ -116,3 +118,27 @@ GooString *timeToDateString(time_t *timet) {
return dateString;
}
+time_t pdfTimeToInteger(GooString *time_str)
+{
+ int year, mon, day, hour, min, sec, tz_hour, tz_minute;
+ char tz;
+ struct tm time_struct;
+
+ if (!parseDateString (time_str->getCString(), &year,
+ &mon, &day, &hour, &min, &sec, &tz, &tz_hour, &tz_minute))
+ return 0;
+
+ time_struct.tm_year = year - 1900;
+ time_struct.tm_mon = mon - 1;
+ time_struct.tm_mday = day;
+ time_struct.tm_hour = hour;
+ time_struct.tm_min = min;
+ time_struct.tm_sec = sec;
+ time_struct.tm_wday = -1;
+ time_struct.tm_yday = -1;
+ time_struct.tm_isdst = -1;
+
+ time_t unix_time = mktime(&time_struct);
+
+ return unix_time;
+}
diff --git a/Build/source/libs/poppler/poppler-src/poppler/DateInfo.h b/Build/source/libs/poppler/poppler-src/poppler/DateInfo.h
index 116350f4134..840ee5ac17f 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/DateInfo.h
+++ b/Build/source/libs/poppler/poppler-src/poppler/DateInfo.h
@@ -4,6 +4,8 @@
//
// Copyright (C) 2008 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
+// Copyright (C) 2015 André Guerreiro <aguerreiro1985@gmail.com>
+// Copyright (C) 2015 André Esser <bepandre@hotmail.com>
//
// 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
@@ -31,5 +33,6 @@ GBool parseDateString(const char *string, int *year, int *month, int *day, int *
* If timet is NULL, current time is used.
*/
GooString *timeToDateString(time_t *timet);
+time_t pdfTimeToInteger(GooString *time_str);
#endif
diff --git a/Build/source/libs/poppler/poppler-src/poppler/Decrypt.cc b/Build/source/libs/poppler/poppler-src/poppler/Decrypt.cc
index ba44f959c31..d67cf4e4144 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/Decrypt.cc
+++ b/Build/source/libs/poppler/poppler-src/poppler/Decrypt.cc
@@ -19,6 +19,7 @@
// Copyright (C) 2009 David Benjamin <davidben@mit.edu>
// Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com>
+// Copyright (C) 2016 Alok Anand <alok4nand@gmail.com>
//
// 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,6 +35,7 @@
#include <string.h>
#include "goo/gmem.h"
#include "goo/grandom.h"
+#include "goo/gtypes_p.h"
#include "Decrypt.h"
#include "Error.h"
@@ -51,11 +53,15 @@ static void aes256EncryptBlock(DecryptAES256State *s, Guchar *in);
static void aes256DecryptBlock(DecryptAES256State *s, Guchar *in, GBool last);
static void sha256(Guchar *msg, int msgLen, Guchar *hash);
+static void sha384(Guchar *msg, int msgLen, Guchar *hash);
+static void sha512(Guchar *msg, int msgLen, Guchar *hash);
+
+static void revision6Hash(GooString *inputPassword, Guchar *K, char *userKey);
static const Guchar passwordPad[32] = {
0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41,
- 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08,
- 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80,
+ 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08,
+ 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80,
0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a
};
@@ -80,7 +86,7 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength,
*ownerPasswordOk = gFalse;
- if (encRevision == 5) {
+ if (encRevision == 5 || encRevision == 6) {
// check the owner password
if (ownerPassword) {
@@ -93,6 +99,10 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength,
memcpy(test + len, ownerKey->getCString() + 32, 8);
memcpy(test + len + 8, userKey->getCString(), 48);
sha256(test, len + 56, test);
+ if (encRevision == 6) {
+ //test contains the initial SHA-256 hash as input K.
+ revision6Hash(ownerPassword, test, userKey->getCString());
+ }
if (!memcmp(test, ownerKey->getCString(), 32)) {
// compute the file key from the owner password
@@ -100,6 +110,10 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength,
memcpy(test + len, ownerKey->getCString() + 40, 8);
memcpy(test + len + 8, userKey->getCString(), 48);
sha256(test, len + 56, test);
+ if (encRevision == 6) {
+ //test contains the initial SHA-256 hash input K.
+ revision6Hash(ownerPassword, test, userKey->getCString());
+ }
aes256KeyExpansion(&state, test, 32, gTrue);
for (i = 0; i < 16; ++i) {
state.cbc[i] = 0;
@@ -125,12 +139,22 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength,
memcpy(test, userPassword->getCString(), len);
memcpy(test + len, userKey->getCString() + 32, 8);
sha256(test, len + 8, test);
+ if(encRevision == 6) {
+ // test contains the initial SHA-256 hash input K.
+ // user key is not used in checking user password.
+ revision6Hash(userPassword, test, NULL);
+ }
if (!memcmp(test, userKey->getCString(), 32)) {
// compute the file key from the user password
memcpy(test, userPassword->getCString(), len);
memcpy(test + len, userKey->getCString() + 40, 8);
sha256(test, len + 8, test);
+ if(encRevision == 6) {
+ //test contains the initial SHA-256 hash input K.
+ //user key is not used in computing intermediate user key.
+ revision6Hash(userPassword, test, NULL);
+ }
aes256KeyExpansion(&state, test, 32, gTrue);
for (i = 0; i < 16; ++i) {
state.cbc[i] = 0;
@@ -141,7 +165,7 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength,
gFalse);
memcpy(fileKey + 16, state.buf, 16);
- return gTrue;
+ return gTrue;
}
}
@@ -1415,3 +1439,328 @@ static void sha256(Guchar *msg, int msgLen, Guchar *hash) {
hash[i*4 + 3] = (Guchar)H[i];
}
}
+//------------------------------------------------------------------------
+// SHA-512 hash (see FIPS 180-4)
+//------------------------------------------------------------------------
+// SHA 384 and SHA 512 use the same sequence of eighty constant 64 bit words.
+static const uint64_t K[80] = {
+ 0x428a2f98d728ae22, 0x7137449123ef65cd, 0xb5c0fbcfec4d3b2f, 0xe9b5dba58189dbbc, 0x3956c25bf348b538,
+ 0x59f111f1b605d019, 0x923f82a4af194f9b, 0xab1c5ed5da6d8118, 0xd807aa98a3030242, 0x12835b0145706fbe,
+ 0x243185be4ee4b28c, 0x550c7dc3d5ffb4e2, 0x72be5d74f27b896f, 0x80deb1fe3b1696b1, 0x9bdc06a725c71235,
+ 0xc19bf174cf692694, 0xe49b69c19ef14ad2, 0xefbe4786384f25e3, 0x0fc19dc68b8cd5b5, 0x240ca1cc77ac9c65,
+ 0x2de92c6f592b0275, 0x4a7484aa6ea6e483, 0x5cb0a9dcbd41fbd4, 0x76f988da831153b5, 0x983e5152ee66dfab,
+ 0xa831c66d2db43210, 0xb00327c898fb213f, 0xbf597fc7beef0ee4, 0xc6e00bf33da88fc2, 0xd5a79147930aa725,
+ 0x06ca6351e003826f, 0x142929670a0e6e70, 0x27b70a8546d22ffc, 0x2e1b21385c26c926, 0x4d2c6dfc5ac42aed,
+ 0x53380d139d95b3df, 0x650a73548baf63de, 0x766a0abb3c77b2a8, 0x81c2c92e47edaee6, 0x92722c851482353b,
+ 0xa2bfe8a14cf10364, 0xa81a664bbc423001, 0xc24b8b70d0f89791, 0xc76c51a30654be30, 0xd192e819d6ef5218,
+ 0xd69906245565a910, 0xf40e35855771202a, 0x106aa07032bbd1b8, 0x19a4c116b8d2d0c8, 0x1e376c085141ab53,
+ 0x2748774cdf8eeb99, 0x34b0bcb5e19b48a8, 0x391c0cb3c5c95a63, 0x4ed8aa4ae3418acb, 0x5b9cca4f7763e373,
+ 0x682e6ff3d6b2b8a3, 0x748f82ee5defb2fc, 0x78a5636f43172f60, 0x84c87814a1f0ab72, 0x8cc702081a6439ec,
+ 0x90befffa23631e28, 0xa4506cebde82bde9, 0xbef9a3f7b2c67915, 0xc67178f2e372532b, 0xca273eceea26619c,
+ 0xd186b8c721c0c207, 0xeada7dd6cde0eb1e, 0xf57d4f7fee6ed178, 0x06f067aa72176fba, 0x0a637dc5a2c898a6,
+ 0x113f9804bef90dae, 0x1b710b35131c471b, 0x28db77f523047d84, 0x32caab7b40c72493, 0x3c9ebe0a15c9bebc,
+ 0x431d67c49c100d4c, 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a, 0x5fcb6fab3ad6faec, 0x6c44198c4a475817
+};
+
+static inline uint64_t rotr(uint64_t x, uint64_t n) {
+ return (x >> n) | (x << (64 - n));
+}
+static inline uint64_t rotl(uint64_t x, uint64_t n){
+ return (x << n) | (x >> (64 - n));
+}
+static inline uint64_t sha512Ch(uint64_t x, uint64_t y, uint64_t z) {
+ return (x & y) ^ (~x & z);
+}
+static inline uint64_t sha512Maj(uint64_t x, uint64_t y, uint64_t z) {
+ return (x & y) ^ (x & z) ^ (y & z);
+}
+static inline uint64_t sha512Sigma0(uint64_t x) {
+ return rotr(x, 28) ^ rotr(x, 34) ^ rotr(x, 39);
+}
+static inline uint64_t sha512Sigma1(uint64_t x) {
+ return rotr(x, 14) ^ rotr(x, 18) ^ rotr(x, 41);
+}
+static inline uint64_t sha512sigma0(uint64_t x) {
+ return rotr(x, 1) ^ rotr(x, 8) ^ (x >> 7);
+}
+static inline uint64_t sha512sigma1(uint64_t x) {
+ return rotr(x, 19) ^ rotr(x, 61) ^ (x >> 6);
+}
+
+static void sha512HashBlock(Guchar *blk, uint64_t *H) {
+ uint64_t W[80];
+ uint64_t a, b, c, d, e, f, g, h;
+ uint64_t T1, T2;
+ Guint t;
+
+ // 1. prepare the message schedule
+ for (t = 0; t < 16; ++t) {
+ W[t] = (((uint64_t)blk[t*8] << 56) |
+ ((uint64_t)blk[t*8 + 1] << 48) |
+ ((uint64_t)blk[t*8 + 2] << 40) |
+ ((uint64_t)blk[t*8 + 3] << 32) |
+ ((uint64_t)blk[t*8 + 4] << 24) |
+ ((uint64_t)blk[t*8 + 5] << 16) |
+ ((uint64_t)blk[t*8 + 6] << 8 ) |
+ ((uint64_t)blk[t*8 + 7]));
+ }
+ for (t = 16; t < 80; ++t) {
+ W[t] = sha512sigma1(W[t-2]) + W[t-7] + sha512sigma0(W[t-15]) + W[t-16];
+ }
+
+ // 2. initialize the eight working variables
+ a = H[0];
+ b = H[1];
+ c = H[2];
+ d = H[3];
+ e = H[4];
+ f = H[5];
+ g = H[6];
+ h = H[7];
+
+ // 3.
+ for (t = 0; t < 80; ++t) {
+ T1 = h + sha512Sigma1(e) + sha512Ch(e,f,g) + K[t] + W[t];
+ T2 = sha512Sigma0(a) + sha512Maj(a,b,c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+ }
+
+ // 4. compute the intermediate hash value
+ H[0] += a;
+ H[1] += b;
+ H[2] += c;
+ H[3] += d;
+ H[4] += e;
+ H[5] += f;
+ H[6] += g;
+ H[7] += h;
+}
+
+static void sha512(Guchar *msg, int msgLen, Guchar *hash) {
+ Guchar blk[128];
+ uint64_t H[8];
+ int blkLen = 0, i;
+ // setting the initial hash value.
+ H[0] = 0x6a09e667f3bcc908;
+ H[1] = 0xbb67ae8584caa73b;
+ H[2] = 0x3c6ef372fe94f82b;
+ H[3] = 0xa54ff53a5f1d36f1;
+ H[4] = 0x510e527fade682d1;
+ H[5] = 0x9b05688c2b3e6c1f;
+ H[6] = 0x1f83d9abfb41bd6b;
+ H[7] = 0x5be0cd19137e2179;
+
+ for (i = 0; i + 128 <= msgLen; i += 128) {
+ sha512HashBlock(msg + i, H);
+ }
+ blkLen = msgLen - i;
+ if (blkLen > 0) {
+ memcpy(blk, msg + i, blkLen);
+ }
+
+ // pad the message
+ blk[blkLen++] = 0x80;
+ if (blkLen > 112) {
+ while (blkLen < 128) {
+ blk[blkLen++] = 0;
+ }
+ sha512HashBlock(blk, H);
+ blkLen = 0;
+ }
+ while (blkLen < 112) {
+ blk[blkLen++] = 0;
+ }
+ blk[112] = 0;
+ blk[113] = 0;
+ blk[114] = 0;
+ blk[115] = 0;
+ blk[116] = 0;
+ blk[117] = 0;
+ blk[118] = 0;
+ blk[119] = 0;
+ blk[120] = 0;
+ blk[121] = 0;
+ blk[122] = 0;
+ blk[123] = 0;
+ blk[124] = (Guchar)(msgLen >> 21);
+ blk[125] = (Guchar)(msgLen >> 13);
+ blk[126] = (Guchar)(msgLen >> 5);
+ blk[127] = (Guchar)(msgLen << 3);
+
+ sha512HashBlock(blk, H);
+
+ // copy the output into the buffer (convert words to bytes)
+ for (i = 0; i < 8; ++i) {
+ hash[i*8] = (Guchar)(H[i] >> 56);
+ hash[i*8 + 1] = (Guchar)(H[i] >> 48);
+ hash[i*8 + 2] = (Guchar)(H[i] >> 40);
+ hash[i*8 + 3] = (Guchar)(H[i] >> 32);
+ hash[i*8 + 4] = (Guchar)(H[i] >> 24);
+ hash[i*8 + 5] = (Guchar)(H[i] >> 16);
+ hash[i*8 + 6] = (Guchar)(H[i] >> 8);
+ hash[i*8 + 7] = (Guchar)H[i];
+ }
+}
+
+//------------------------------------------------------------------------
+// SHA-384 (see FIPS 180-4)
+//------------------------------------------------------------------------
+//The algorithm is defined in the exact same manner as SHA 512 with 2 exceptions
+//1.Initial hash value is different.
+//2.A 384 bit message digest is obtained by truncating the final hash value.
+static void sha384(Guchar *msg, int msgLen, Guchar *hash) {
+ Guchar blk[128];
+ uint64_t H[8];
+ int blkLen, i;
+//setting initial hash values
+ H[0] = 0xcbbb9d5dc1059ed8;
+ H[1] = 0x629a292a367cd507;
+ H[2] = 0x9159015a3070dd17;
+ H[3] = 0x152fecd8f70e5939;
+ H[4] = 0x67332667ffc00b31;
+ H[5] = 0x8eb44a8768581511;
+ H[6] = 0xdb0c2e0d64f98fa7;
+ H[7] = 0x47b5481dbefa4fa4;
+//SHA 384 will use the same sha512HashBlock function.
+ blkLen = 0;
+ for (i = 0; i + 128 <= msgLen; i += 128) {
+ sha512HashBlock(msg + i, H);
+ }
+ blkLen = msgLen - i;
+ if (blkLen > 0) {
+ memcpy(blk, msg + i, blkLen);
+ }
+
+ // pad the message
+ blk[blkLen++] = 0x80;
+ if (blkLen > 112) {
+ while (blkLen < 128) {
+ blk[blkLen++] = 0;
+ }
+ sha512HashBlock(blk, H);
+ blkLen = 0;
+ }
+ while (blkLen < 112) {
+ blk[blkLen++] = 0;
+ }
+ blk[112] = 0;
+ blk[113] = 0;
+ blk[114] = 0;
+ blk[115] = 0;
+ blk[116] = 0;
+ blk[117] = 0;
+ blk[118] = 0;
+ blk[119] = 0;
+ blk[120] = 0;
+ blk[121] = 0;
+ blk[122] = 0;
+ blk[123] = 0;
+ blk[124] = (Guchar)(msgLen >> 21);
+ blk[125] = (Guchar)(msgLen >> 13);
+ blk[126] = (Guchar)(msgLen >> 5);
+ blk[127] = (Guchar)(msgLen << 3);
+
+ sha512HashBlock(blk, H);
+
+ // copy the output into the buffer (convert words to bytes)
+ // hash is truncated to 384 bits.
+ for (i = 0; i < 6; ++i) {
+ hash[i*8] = (Guchar)(H[i] >> 56);
+ hash[i*8 + 1] = (Guchar)(H[i] >> 48);
+ hash[i*8 + 2] = (Guchar)(H[i] >> 40);
+ hash[i*8 + 3] = (Guchar)(H[i] >> 32);
+ hash[i*8 + 4] = (Guchar)(H[i] >> 24);
+ hash[i*8 + 5] = (Guchar)(H[i] >> 16);
+ hash[i*8 + 6] = (Guchar)(H[i] >> 8);
+ hash[i*8 + 7] = (Guchar)H[i];
+ }
+}
+
+//------------------------------------------------------------------------
+// Section 7.6.3.3 (Encryption Key algorithm) of ISO/DIS 32000-2
+// Algorithm 2.B:Computing a hash (for revision 6).
+//------------------------------------------------------------------------
+static void revision6Hash(GooString *inputPassword, Guchar *K, char *userKey) {
+ Guchar K1[64*(127+64+48)];
+ Guchar E[64*(127+64+48)];
+ DecryptAESState state;
+ Guchar aesKey[16];
+ Guchar BE16byteNumber[16];
+
+ int inputPasswordLength = inputPassword->getLength();
+ int KLength = 32;
+ int userKeyLength = 0;
+ if (userKey) {
+ userKeyLength = 48;
+ }
+ int sequenceLength;
+ int totalLength;
+ int rounds = 0;
+
+ while(rounds < 64 || rounds < E[totalLength-1] + 32 ) {
+ sequenceLength = inputPasswordLength + KLength + userKeyLength;
+ totalLength = 64 * sequenceLength;
+ //a.make the string K1
+ memcpy(K1, inputPassword, inputPasswordLength);
+ memcpy(K1 + inputPasswordLength, K , KLength);
+ memcpy(K1 + inputPasswordLength + KLength, userKey, userKeyLength);
+ for(int i = 1; i < 64 ; ++i) {
+ memcpy(K1 + (i * sequenceLength),K1,sequenceLength);
+ }
+ //b.Encrypt K1
+ memcpy(aesKey,K,16);
+ memcpy(state.cbc,K + 16,16);
+ memcpy(state.buf, state.cbc, 16); // Copy CBC IV to buf
+ state.bufIdx = 0;
+ state.paddingReached = gFalse;
+ aesKeyExpansion(&state,aesKey,16,gFalse);
+
+ for(int i = 0; i < (4 * sequenceLength); i++) {
+ aesEncryptBlock(&state,K1 + (16 * i));
+ memcpy(E +(16 * i),state.buf,16);
+ }
+ memcpy(BE16byteNumber,E,16);
+ //c.Taking the first 16 Bytes of E as unsigned big-endian integer,
+ //compute the remainder,modulo 3.
+ uint64_t N1 = 0,N2 = 0,N3 = 0;
+ // N1 contains first 8 bytes of BE16byteNumber
+ N1 = ((uint64_t)BE16byteNumber[0] << 56 | (uint64_t)BE16byteNumber[1] << 48
+ |(uint64_t)BE16byteNumber[2] << 40 | (uint64_t)BE16byteNumber[3] << 32
+ |(uint64_t)BE16byteNumber[4] << 24 | (uint64_t)BE16byteNumber[5] << 16
+ |(uint64_t)BE16byteNumber[6] << 8 | (uint64_t)BE16byteNumber[7] );
+ uint64_t rem = N1 % 3 ;
+ // N2 conatains 0s in higer 4 bytes and 9th to 12 th bytes of BE16byteNumber in lower 4 bytes.
+ N2 = ((uint64_t)BE16byteNumber[8] << 24 | (uint64_t)BE16byteNumber[9] << 16
+ |(uint64_t)BE16byteNumber[10] << 8 | (uint64_t)BE16byteNumber[11] );
+ rem = ((rem << 32 ) | N2) % 3 ;
+ // N3 conatains 0s in higer 4 bytes and 13th to 16th bytes of BE16byteNumber in lower 4 bytes.
+ N3 = ((uint64_t)BE16byteNumber[12] << 24 | (uint64_t)BE16byteNumber[13] << 16
+ |(uint64_t)BE16byteNumber[14] << 8 | (uint64_t)BE16byteNumber[15] );
+ rem = ((rem << 32 ) | N3) % 3 ;
+
+ //d.If remainder is 0 perform SHA-256
+ if(rem == 0) {
+ KLength = 32;
+ sha256(E, totalLength, K);
+ }
+ // remainder is 1 perform SHA-384
+ else if(rem == 1) {
+ KLength = 48;
+ sha384(E, totalLength, K);
+ }
+ // remainder is 2 perform SHA-512
+ else if(rem == 2) {
+ KLength = 64;
+ sha512(E, totalLength, K);
+ }
+ rounds++;
+ }
+ // the first 32 bytes of the final K are the output of the function.
+}
diff --git a/Build/source/libs/poppler/poppler-src/poppler/FlateEncoder.cc b/Build/source/libs/poppler/poppler-src/poppler/FlateEncoder.cc
new file mode 100644
index 00000000000..49a0fa37209
--- /dev/null
+++ b/Build/source/libs/poppler/poppler-src/poppler/FlateEncoder.cc
@@ -0,0 +1,148 @@
+//========================================================================
+//
+// FlateEncoder.cc
+//
+// Copyright (C) 2016, William Bader <williambader@hotmail.com>
+//
+// This file is under the GPLv2 or later license
+//
+//========================================================================
+
+#include <config.h>
+
+#ifdef USE_GCC_PRAGMAS
+#pragma implementation
+#endif
+
+#include "FlateEncoder.h"
+
+//------------------------------------------------------------------------
+// FlateEncoder
+//------------------------------------------------------------------------
+
+FlateEncoder::FlateEncoder(Stream *strA):
+ FilterStream(strA)
+{
+ int zlib_status;
+
+ outBufPtr = outBufEnd = outBuf;
+ inBufEof = outBufEof = gFalse;
+
+ zlib_stream.zalloc = Z_NULL;
+ zlib_stream.zfree = Z_NULL;
+ zlib_stream.opaque = Z_NULL;
+
+ zlib_status = deflateInit(&zlib_stream, Z_DEFAULT_COMPRESSION);
+
+ if (zlib_status != Z_OK) {
+ inBufEof = outBufEof = gTrue;
+ error(errInternal, -1, "Internal: deflateInit() failed in FlateEncoder::FlateEncoder()");
+ }
+
+ zlib_stream.next_out = outBufEnd;
+ zlib_stream.avail_out = 1; /* anything but 0 to trigger a read */
+}
+
+FlateEncoder::~FlateEncoder() {
+ deflateEnd(&zlib_stream);
+ if (str->isEncoder()) {
+ delete str;
+ }
+}
+
+void FlateEncoder::reset() {
+ int zlib_status;
+
+ str->reset();
+
+ outBufPtr = outBufEnd = outBuf;
+ inBufEof = outBufEof = gFalse;
+
+ deflateEnd(&zlib_stream);
+
+ zlib_status = deflateInit(&zlib_stream, Z_DEFAULT_COMPRESSION);
+
+ if (zlib_status != Z_OK) {
+ inBufEof = outBufEof = gTrue;
+ error(errInternal, -1, "Internal: deflateInit() failed in FlateEncoder::reset()");
+ }
+
+ zlib_stream.next_out = outBufEnd;
+ zlib_stream.avail_out = 1; /* anything but 0 to trigger a read */
+}
+
+GBool FlateEncoder::fillBuf() {
+ int n;
+ unsigned int starting_avail_out;
+ int zlib_status;
+
+ /* If the output is done, don't try to read more. */
+
+ if (outBufEof) {
+ return gFalse;
+ }
+
+ /* The output buffer should be empty. */
+ /* If it is not empty, push any processed data to the start. */
+
+ if (outBufPtr > outBuf && outBufPtr < outBufEnd) {
+ n = outBufEnd - outBufPtr;
+ memmove(outBuf, outBufPtr, n);
+ outBufEnd = &outBuf[n];
+ } else {
+ outBufEnd = outBuf;
+ }
+ outBufPtr = outBuf;
+
+ /* Keep feeding zlib until we get output. */
+ /* zlib might consume a few input buffers */
+ /* before it starts producing output. */
+
+ do {
+
+ /* avail_out > 0 means that zlib has depleted its input */
+ /* and needs a new chunk of input in order to generate */
+ /* more output. */
+
+ if (zlib_stream.avail_out != 0) {
+
+ /* Fill the input buffer */
+
+ n = (inBufEof? 0: str->doGetChars(inBufSize, inBuf));
+
+ if (n == 0) {
+ inBufEof = gTrue;
+ }
+
+ zlib_stream.next_in = inBuf;
+ zlib_stream.avail_in = n;
+ }
+
+ /* Ask zlib for output. */
+
+ zlib_stream.next_out = outBufEnd;
+ starting_avail_out = &outBuf[ outBufSize ] - outBufEnd;
+ zlib_stream.avail_out = starting_avail_out;
+
+ zlib_status = deflate(&zlib_stream, (inBufEof? Z_FINISH: Z_NO_FLUSH));
+
+ if (zlib_status == Z_STREAM_ERROR ||
+ zlib_stream.avail_out < 0 ||
+ zlib_stream.avail_out > starting_avail_out) {
+ /* Unrecoverable error */
+ inBufEof = outBufEof = gTrue;
+ error(errInternal, -1, "Internal: deflate() failed in FlateEncoder::fillBuf()");
+ return gFalse;
+ }
+
+ } while (zlib_stream.avail_out == outBufSize && !inBufEof);
+
+ outBufEnd = &outBuf[ outBufSize ] - zlib_stream.avail_out;
+
+ if (inBufEof && zlib_stream.avail_out != 0) {
+ outBufEof = gTrue;
+ }
+
+ return outBufPtr < outBufEnd;
+}
+
diff --git a/Build/source/libs/poppler/poppler-src/poppler/FlateEncoder.h b/Build/source/libs/poppler/poppler-src/poppler/FlateEncoder.h
new file mode 100644
index 00000000000..6dee292876d
--- /dev/null
+++ b/Build/source/libs/poppler/poppler-src/poppler/FlateEncoder.h
@@ -0,0 +1,73 @@
+//========================================================================
+//
+// FlateEncoder.h
+//
+// Copyright (C) 2016, William Bader <williambader@hotmail.com>
+//
+// This file is under the GPLv2 or later license
+//
+//========================================================================
+
+#ifndef FLATEENCODE_H
+#define FLATEENCODE_H
+
+#ifdef USE_GCC_PRAGMAS
+#pragma interface
+#endif
+
+#include "poppler-config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <string.h>
+#include <ctype.h>
+#include "goo/gmem.h"
+#include "goo/gfile.h"
+#include "Error.h"
+#include "Object.h"
+#include "Decrypt.h"
+
+#include "Stream.h"
+
+extern "C" {
+#include <zlib.h>
+}
+
+//------------------------------------------------------------------------
+// FlateEncoder
+//------------------------------------------------------------------------
+
+class FlateEncoder: public FilterStream {
+public:
+
+ FlateEncoder(Stream *strA);
+ virtual ~FlateEncoder();
+ virtual StreamKind getKind() { return strWeird; }
+ virtual void reset();
+ virtual int getChar()
+ { return (outBufPtr >= outBufEnd && !fillBuf()) ? EOF : (*outBufPtr++ & 0xff); }
+ virtual int lookChar()
+ { return (outBufPtr >= outBufEnd && !fillBuf()) ? EOF : (*outBufPtr & 0xff); }
+ virtual GooString *getPSFilter(int psLevel, const char *indent) { return NULL; }
+ virtual GBool isBinary(GBool last = gTrue) { return gTrue; }
+ virtual GBool isEncoder() { return gTrue; }
+
+private:
+
+ static const int inBufSize = 16384;
+ static const int outBufSize = inBufSize;
+ Guchar inBuf[ inBufSize ];
+ Guchar outBuf[ outBufSize ];
+ Guchar *outBufPtr;
+ Guchar *outBufEnd;
+ GBool inBufEof;
+ GBool outBufEof;
+ z_stream zlib_stream;
+
+ GBool fillBuf();
+};
+
+#endif
diff --git a/Build/source/libs/poppler/poppler-src/poppler/FlateStream.cc b/Build/source/libs/poppler/poppler-src/poppler/FlateStream.cc
index 7990dadd821..acc716c1cce 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/FlateStream.cc
+++ b/Build/source/libs/poppler/poppler-src/poppler/FlateStream.cc
@@ -4,11 +4,24 @@
//
// Copyright (C) 2005, Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2010, Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2016, William Bader <williambader@hotmail.com>
//
// This file is under the GPLv2 or later license
//
//========================================================================
+
+#include <config.h>
+
+#ifdef USE_GCC_PRAGMAS
+#pragma implementation
+#endif
+
+#include "poppler-config.h"
+
+#if ENABLE_ZLIB_UNCOMPRESS
+
#include "FlateStream.h"
+
FlateStream::FlateStream(Stream *strA, int predictor, int columns, int colors, int bits) :
FilterStream(strA)
{
@@ -126,3 +139,5 @@ GooString *FlateStream::getPSFilter(int psLevel, const char *indent) {
GBool FlateStream::isBinary(GBool last) {
return str->isBinary(gTrue);
}
+
+#endif
diff --git a/Build/source/libs/poppler/poppler-src/poppler/Form.cc b/Build/source/libs/poppler/poppler-src/poppler/Form.cc
index a46a6590f27..4dd56b7800d 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 <julienr@svn.gnome.org>
-// Copyright 2007-2012 Albert Astals Cid <aacid@kde.org>
+// Copyright 2007-2012, 2015, 2016 Albert Astals Cid <aacid@kde.org>
// Copyright 2007-2008, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright 2007, 2013 Adrian Johnson <ajohnson@redneon.com>
// Copyright 2007 Iñigo Martínez <inigomartinez@gmail.com>
@@ -15,7 +15,9 @@
// Copyright 2009 KDAB via Guillermo Amaral <gamaral@amaral.com.mx>
// Copyright 2010, 2012 Mark Riedesel <mark@klowner.com>
// Copyright 2012 Fabio D'Urso <fabiodurso@hotmail.it>
-//
+// Copyright 2015 André Guerreiro <aguerreiro1985@gmail.com>
+// Copyright 2015 André Esser <bepandre@hotmail.com>
+//
//========================================================================
#include <config.h>
@@ -36,6 +38,11 @@
#include "Gfx.h"
#include "Form.h"
#include "PDFDoc.h"
+#include "DateInfo.h"
+#ifdef ENABLE_NSS3
+#include "SignatureHandler.h"
+#endif
+#include "SignatureInfo.h"
#include "XRef.h"
#include "PDFDocEncoding.h"
#include "Annot.h"
@@ -441,6 +448,11 @@ FormWidgetSignature::FormWidgetSignature(PDFDoc *docA, Object *aobj, unsigned nu
parent = static_cast<FormFieldSignature*>(field);
}
+SignatureInfo *FormWidgetSignature::validateSignature(bool doVerifyCert, bool forceRevalidation)
+{
+ return parent->validateSignature(doVerifyCert, forceRevalidation);
+}
+
void FormWidgetSignature::updateWidgetAppearance()
{
// Unimplemented
@@ -1370,11 +1382,162 @@ GooString *FormFieldChoice::getSelectedChoice() {
FormFieldSignature::FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents)
: FormField(docA, dict, ref, parent, usedParents, formSignature)
{
+ signature = NULL;
+
+ signature_info = new SignatureInfo();
+ parseInfo();
}
FormFieldSignature::~FormFieldSignature()
{
+ byte_range.free();
+ delete signature_info;
+ delete signature;
+}
+
+void FormFieldSignature::parseInfo()
+{
+ if (!obj.isDict())
+ return;
+
+ Object sig_dict, contents_obj, time_of_signing, subfilterName;
+
+ // retrieve PKCS#7
+ obj.dictLookup("V", &sig_dict);
+ if (!sig_dict.isDict()) {
+ sig_dict.free();
+ return;
+ }
+
+ sig_dict.dictLookup("Contents", &contents_obj);
+ if (contents_obj.isString()) {
+ signature = contents_obj.getString()->copy();
+ }
+ contents_obj.free();
+
+ sig_dict.dictLookup("ByteRange", &byte_range);
+
+ // retrieve SigningTime
+ sig_dict.dictLookup("M", &time_of_signing);
+ if (time_of_signing.isString()) {
+ GooString *time_str = time_of_signing.getString();
+ signature_info->setSigningTime(pdfTimeToInteger(time_str)); // Put this information directly in SignatureInfo object
+ time_of_signing.free();
+ }
+
+ // check if subfilter is supported for signature validation, only detached signatures work for now
+ sig_dict.dictLookup("SubFilter", &subfilterName);
+ if (subfilterName.isName("adbe.pkcs7.detached") || subfilterName.isName("adbe.pkcs7.sha1")) {
+ signature_info->setSubFilterSupport(true);
+ }
+
+ subfilterName.free();
+ sig_dict.free();
+}
+
+void FormFieldSignature::hashSignedDataBlock(SignatureHandler *handler, Goffset block_len)
+{
+#ifdef ENABLE_NSS3
+ const int BLOCK_SIZE = 4096;
+ unsigned char signed_data_buffer[BLOCK_SIZE];
+
+ Goffset i = 0;
+ while(i < block_len)
+ {
+ Goffset bytes_left = block_len - i;
+ if (bytes_left < BLOCK_SIZE)
+ {
+ doc->getBaseStream()->doGetChars(bytes_left, signed_data_buffer);
+ handler->updateHash(signed_data_buffer, bytes_left);
+ i = block_len;
+ }
+ else
+ {
+ doc->getBaseStream()->doGetChars(BLOCK_SIZE, signed_data_buffer);
+ handler->updateHash(signed_data_buffer, BLOCK_SIZE);
+ i += BLOCK_SIZE;
+ }
+ }
+#endif
+}
+
+
+SignatureInfo *FormFieldSignature::validateSignature(bool doVerifyCert, bool forceRevalidation)
+{
+#ifdef ENABLE_NSS3
+ if (!signature_info->isSubfilterSupported()) {
+ error(errUnimplemented, 0, "Unable to validate this type of signature");
+ return signature_info;
+ }
+
+ if (signature_info->getSignatureValStatus() != SIGNATURE_NOT_VERIFIED && !forceRevalidation) {
+ return signature_info;
+ }
+
+ if (signature == NULL) {
+ error(errSyntaxError, 0, "Invalid or missing Signature string");
+ return signature_info;
+ }
+
+ if (!byte_range.isArray()) {
+ error(errSyntaxError, 0, "Invalid or missing ByteRange array");
+ return signature_info;
+ }
+
+ int arrayLen = byte_range.arrayGetLength();
+ if (arrayLen < 2) {
+ error(errSyntaxError, 0, "Too few elements in ByteRange array");
+ return signature_info;
+ }
+ NSSCMSVerificationStatus sig_val_state;
+ SECErrorCodes cert_val_state;
+ const int signature_len = signature->getLength();
+ unsigned char *signatureuchar = (unsigned char *)gmalloc(signature_len);
+ memcpy(signatureuchar, signature->getCString(), signature_len);
+ SignatureHandler signature_handler(signatureuchar, signature_len);
+
+ Goffset fileLength = doc->getBaseStream()->getLength();
+ for (int i = 0; i < arrayLen/2; i++) {
+ Object offsetObj, lenObj;
+ byte_range.arrayGet(i*2, &offsetObj);
+ byte_range.arrayGet(i*2+1, &lenObj);
+
+ if (!offsetObj.isIntOrInt64() || !lenObj.isIntOrInt64()) {
+ error(errSyntaxError, 0, "Illegal values in ByteRange array");
+ return signature_info;
+ }
+
+ Goffset offset = offsetObj.getIntOrInt64();
+ Goffset len = lenObj.getIntOrInt64();
+
+ if (offset < 0 || offset >= fileLength || len < 0 || len > fileLength || offset + len > fileLength) {
+ error(errSyntaxError, 0, "Illegal values in ByteRange array");
+ return signature_info;
+ }
+
+ doc->getBaseStream()->setPos(offset);
+ hashSignedDataBlock(&signature_handler, len);
+ }
+
+ sig_val_state = signature_handler.validateSignature();
+ signature_info->setSignatureValStatus(SignatureHandler::NSS_SigTranslate(sig_val_state));
+ signature_info->setSignerName(signature_handler.getSignerName());
+
+ // verify if signature contains a 'signing time' attribute
+ if (signature_handler.getSigningTime() != 0) {
+ signature_info->setSigningTime(signature_handler.getSigningTime());
+ }
+
+ if (sig_val_state != NSSCMSVS_GoodSignature || !doVerifyCert) {
+ return signature_info;
+ }
+
+ cert_val_state = signature_handler.validateCertificate();
+ signature_info->setCertificateValStatus(SignatureHandler::NSS_CertTranslate(cert_val_state));
+
+#endif
+ return signature_info;
}
#ifdef DEBUG_FORMS
@@ -1475,7 +1638,7 @@ Form::Form(PDFDoc *docA, Object* acroFormA)
Form::~Form() {
int i;
- for(i = 0; i< numFields; ++i)
+ for(i = 0; i < numFields; ++i)
delete rootFields[i];
gfree (rootFields);
delete defaultAppearance;
diff --git a/Build/source/libs/poppler/poppler-src/poppler/Form.h b/Build/source/libs/poppler/poppler-src/poppler/Form.h
index 3778ff6f2ef..b566fe03854 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/Form.h
+++ b/Build/source/libs/poppler/poppler-src/poppler/Form.h
@@ -6,11 +6,13 @@
//
// Copyright 2006 Julien Rebetez <julienr@svn.gnome.org>
// Copyright 2007, 2008, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
-// Copyright 2007-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright 2007-2010, 2012, 2015 Albert Astals Cid <aacid@kde.org>
// Copyright 2010 Mark Riedesel <mark@klowner.com>
// Copyright 2011 Pino Toscano <pino@kde.org>
// Copyright 2012 Fabio D'Urso <fabiodurso@hotmail.it>
// Copyright 2013 Adrian Johnson <ajohnson@redneon.com>
+// Copyright 2015 André Guerreiro <aguerreiro1985@gmail.com>
+// Copyright 2015 André Esser <bepandre@hotmail.com>
//
//========================================================================
@@ -35,6 +37,8 @@ class Annots;
class LinkAction;
class GfxResources;
class PDFDoc;
+class SignatureInfo;
+class SignatureHandler;
enum FormFieldType {
formButton,
@@ -245,6 +249,9 @@ class FormWidgetSignature: public FormWidget {
public:
FormWidgetSignature(PDFDoc *docA, Object *dict, unsigned num, Ref ref, FormField *p);
void updateWidgetAppearance();
+
+ SignatureInfo *validateSignature(bool doVerifyCert, bool forceRevalidation);
+
protected:
FormFieldSignature *parent;
};
@@ -487,8 +494,17 @@ class FormFieldSignature: public FormField {
public:
FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents);
+ SignatureInfo *validateSignature(bool doVerifyCert, bool forceRevalidation);
+
virtual ~FormFieldSignature();
+private:
+ void parseInfo();
+ void hashSignedDataBlock(SignatureHandler *handler, Goffset block_len);
+ Object byte_range;
+ GooString *signature;
+ SignatureInfo *signature_info;
+
#ifdef DEBUG_FORMS
void print(int indent = 0);
#endif
diff --git a/Build/source/libs/poppler/poppler-src/poppler/Gfx.cc b/Build/source/libs/poppler/poppler-src/poppler/Gfx.cc
index 577c482ec18..cc6b66d767f 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/Gfx.cc
+++ b/Build/source/libs/poppler/poppler-src/poppler/Gfx.cc
@@ -2,7 +2,7 @@
//
// Gfx.cc
//
-// Copyright 1996-2003 Glyph & Cog, LLC
+// Copyright 1996-2013 Glyph & Cog, LLC
//
//========================================================================
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jonathan Blandford <jrb@redhat.com>
-// Copyright (C) 2005-2013, 2015 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2005-2013, 2015, 2016 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2006 Thorkild Stray <thorkild@ifi.uio.no>
// Copyright (C) 2006 Kristian Høgsberg <krh@redhat.com>
// Copyright (C) 2006-2011 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -28,7 +28,7 @@
// Copyright (C) 2008 Michael Vrable <mvrable@cs.ucsd.edu>
// Copyright (C) 2008 Hib Eris <hib@hiberis.nl>
// Copyright (C) 2009 M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
-// Copyright (C) 2009-2015 Thomas Freitag <Thomas.Freitag@alfa.de>
+// Copyright (C) 2009-2016 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2009 William Bader <williambader@hotmail.com>
// Copyright (C) 2009, 2010 David Benjamin <davidben@mit.edu>
// Copyright (C) 2010 Nils Höglund <nils.hoglund@gmail.com>
@@ -2126,7 +2126,12 @@ void Gfx::doTilingPatternFill(GfxTilingPattern *tPat,
btm = baseMatrix;
ptm = tPat->getMatrix();
// iCTM = invert CTM
- det = 1 / (ctm[0] * ctm[3] - ctm[1] * ctm[2]);
+ det = ctm[0] * ctm[3] - ctm[1] * ctm[2];
+ if (fabs(det) < 0.000001) {
+ error(errSyntaxError, getPos(), "Singular matrix in tiling pattern fill");
+ return;
+ }
+ det = 1 / det;
ictm[0] = ctm[3] * det;
ictm[1] = -ctm[1] * det;
ictm[2] = -ctm[2] * det;
@@ -2149,7 +2154,12 @@ void Gfx::doTilingPatternFill(GfxTilingPattern *tPat,
m[5] = m1[4] * ictm[1] + m1[5] * ictm[3] + ictm[5];
// construct a (device space) -> (pattern space) transform matrix
- det = 1 / (m1[0] * m1[3] - m1[1] * m1[2]);
+ det = m1[0] * m1[3] - m1[1] * m1[2];
+ if (fabs(det) < 0.000001) {
+ error(errSyntaxError, getPos(), "Singular matrix in tiling pattern fill");
+ return;
+ }
+ det = 1 / det;
imb[0] = m1[3] * det;
imb[1] = -m1[1] * det;
imb[2] = -m1[2] * det;
@@ -2335,7 +2345,12 @@ void Gfx::doShadingPatternFill(GfxShadingPattern *sPat,
btm = baseMatrix;
ptm = sPat->getMatrix();
// iCTM = invert CTM
- det = 1 / (ctm[0] * ctm[3] - ctm[1] * ctm[2]);
+ det = ctm[0] * ctm[3] - ctm[1] * ctm[2];
+ if (fabs(det) < 0.000001) {
+ error(errSyntaxError, getPos(), "Singular matrix in shading pattern fill");
+ return;
+ }
+ det = 1 / det;
ictm[0] = ctm[3] * det;
ictm[1] = -ctm[1] * det;
ictm[2] = -ctm[2] * det;
@@ -4553,7 +4568,34 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) {
delete maskColorMap;
goto err1;
}
- //~ handle the Matte entry
+ // handle the Matte entry
+ maskDict->lookup("Matte", &obj1);
+ if (obj1.isArray()) {
+ if (obj1.getArray()->getLength() != colorSpace->getNComps()) {
+ error(errSyntaxError, -1, "Matte entry should have {0:d} components but has {1:d}",
+ colorSpace->getNComps(), obj1.getArray()->getLength());
+ } else if (maskWidth != width || maskHeight != height) {
+ error(errSyntaxError, -1, "Softmask with matte entry {0:d} x {1:d} must have same geometry as the image {2:d} x {3:d}",
+ maskWidth, maskHeight, width, height);
+ } else {
+ GfxColor matteColor;
+ for (i = 0; i < colorSpace->getNComps(); i++) {
+ obj1.getArray()->get(i, &obj2);
+ if (!obj2.isNum()) {
+ obj2.free();
+ error(errSyntaxError, -1, "Matte entry {0:d} should be a number but it's of type {1:d}", i, obj2.getType());
+
+ break;
+ }
+ matteColor.c[i] = dblToCol(obj2.getNum());
+ obj2.free();
+ }
+ if (i == colorSpace->getNComps()) {
+ maskColorMap->setMatteColor(&matteColor);
+ }
+ }
+ }
+ obj1.free();
haveSoftMask = gTrue;
} else if (maskObj.isArray()) {
// color key mask
diff --git a/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc b/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc
index bd3b42d5153..25196b40be8 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc
+++ b/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc
@@ -18,7 +18,7 @@
// Copyright (C) 2006, 2010 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2006-2015 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2009, 2012 Koji Otani <sho@bbr.jp>
-// Copyright (C) 2009, 2011-2015 Thomas Freitag <Thomas.Freitag@alfa.de>
+// Copyright (C) 2009, 2011-2016 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2009 Christian Persch <chpe@gnome.org>
// Copyright (C) 2010 Paweł Wiejacha <pawel.wiejacha@gmail.com>
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com>
@@ -809,6 +809,9 @@ GfxColorSpace *GfxCalGrayColorSpace::copy() {
cs->blackY = blackY;
cs->blackZ = blackZ;
cs->gamma = gamma;
+ cs->kr = kr;
+ cs->kg = kg;
+ cs->kb = kb;
#ifdef USE_CMS
cs->transform = transform;
if (transform != NULL) transform->ref();
@@ -1190,6 +1193,9 @@ GfxColorSpace *GfxCalRGBColorSpace::copy() {
cs->gammaR = gammaR;
cs->gammaG = gammaG;
cs->gammaB = gammaB;
+ cs->kr = kr;
+ cs->kg = kg;
+ cs->kb = kb;
for (i = 0; i < 9; ++i) {
cs->mat[i] = mat[i];
}
@@ -5821,6 +5827,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
GBool useByteLookup;
ok = gTrue;
+ useMatte = gFalse;
// bits per component and color space
bits = bitsA;
@@ -5983,6 +5990,8 @@ GfxImageColorMap::GfxImageColorMap(GfxImageColorMap *colorMap) {
bits = colorMap->bits;
nComps = colorMap->nComps;
nComps2 = colorMap->nComps2;
+ useMatte = colorMap->useMatte;
+ matteColor = colorMap->matteColor;
colorSpace2 = NULL;
for (k = 0; k < gfxColorMaxComps; ++k) {
lookup[k] = NULL;
@@ -6570,7 +6579,7 @@ void GfxPath::offset(double dx, double dy) {
}
//------------------------------------------------------------------------
-// GfxState
+//
//------------------------------------------------------------------------
GfxState::ReusablePathIterator::ReusablePathIterator(GfxPath *path)
: path(path),
diff --git a/Build/source/libs/poppler/poppler-src/poppler/GfxState.h b/Build/source/libs/poppler/poppler-src/poppler/GfxState.h
index c20438b33ab..d35935505a0 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/GfxState.h
+++ b/Build/source/libs/poppler/poppler-src/poppler/GfxState.h
@@ -20,7 +20,7 @@
// Copyright (C) 2009-2011, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com>
// Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com>
-// Copyright (C) 2011-2014 Thomas Freitag <Thomas.Freitag@alfa.de>
+// Copyright (C) 2011-2014, 2016 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2013 Lu Wang <coolwanglu@gmail.com>
// Copyright (C) 2015 Adrian Johnson <ajohnson@redneon.com>
//
@@ -1194,6 +1194,9 @@ public:
void getDeviceN(Guchar *x, GfxColor *deviceN);
void getColor(Guchar *x, GfxColor *color);
+ // Matte color ops
+ void setMatteColor(GfxColor *color) { useMatte = gTrue; matteColor = *color; }
+ GfxColor *getMatteColor() { return (useMatte) ? &matteColor : NULL; }
private:
GfxImageColorMap(GfxImageColorMap *colorMap);
@@ -1212,6 +1215,8 @@ private:
decodeLow[gfxColorMaxComps];
double // max - min value for each component
decodeRange[gfxColorMaxComps];
+ GBool useMatte;
+ GfxColor matteColor;
GBool ok;
};
diff --git a/Build/source/libs/poppler/poppler-src/poppler/JPEG2000Stream.cc b/Build/source/libs/poppler/poppler-src/poppler/JPEG2000Stream.cc
index 4c632d717e9..7daa23d6135 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/JPEG2000Stream.cc
+++ b/Build/source/libs/poppler/poppler-src/poppler/JPEG2000Stream.cc
@@ -6,7 +6,7 @@
//
// Copyright 2008-2010, 2012 Albert Astals Cid <aacid@kde.org>
// Copyright 2011 Daniel Glöckner <daniel-gl@gmx.net>
-// Copyright 2014 Thomas Freitag <Thomas.Freitag@alfa.de>
+// Copyright 2014, 2016 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright 2013, 2014 Adrian Johnson <ajohnson@redneon.com>
// Copyright 2015 Adam Reichold <adam.reichold@t-online.de>
// Copyright 2015 Jakub Wilk <jwilk@jwilk.net>
@@ -41,16 +41,32 @@ struct JPXStreamPrivate {
int ccounter;
int npixels;
int ncomps;
+ GBool indexed;
GBool inited;
+ int smaskInData;
#ifdef USE_OPENJPEG1
opj_dinfo_t *dinfo;
- void init2(unsigned char *buf, int bufLen, OPJ_CODEC_FORMAT format);
+ void init2(unsigned char *buf, int bufLen, OPJ_CODEC_FORMAT format, GBool indexed);
#endif
#ifdef USE_OPENJPEG2
- void init2(OPJ_CODEC_FORMAT format, unsigned char *data, int length);
+ void init2(OPJ_CODEC_FORMAT format, unsigned char *data, int length, GBool indexed);
#endif
};
+static inline Guchar adjustComp(int r, int adjust, int depth, int sgndcorr, GBool indexed) {
+ if (!indexed) {
+ r += sgndcorr;
+ if (adjust) {
+ r = (r >> adjust)+((r >> (adjust-1))%2);
+ } else if (depth < 8) {
+ r = r << (8 - depth);
+ }
+ }
+ if (unlikely(r > 255))
+ r = 255;
+ return r;
+}
+
static inline int doLookChar(JPXStreamPrivate* priv) {
if (unlikely(priv->counter >= priv->npixels))
return EOF;
@@ -73,6 +89,7 @@ JPXStream::JPXStream(Stream *strA) : FilterStream(strA) {
priv->image = NULL;
priv->npixels = 0;
priv->ncomps = 0;
+ priv->indexed = gFalse;
#ifdef USE_OPENJPEG1
priv->dinfo = NULL;
#endif
@@ -143,9 +160,21 @@ void JPXStream::getImageParams(int *bitsPerComponent, StreamColorSpaceMode *csMo
if (unlikely(priv->inited == gFalse)) { init(); }
*bitsPerComponent = 8;
- if (priv->image && priv->image->numcomps == 3)
+ int numComps = (priv->image) ? priv->image->numcomps : 1;
+ if (priv->image) {
+#ifdef USE_OPENJPEG1
+ if (priv->image->color_space == CLRSPC_SRGB && numComps == 4) { numComps = 3; }
+ else if (priv->image->color_space == CLRSPC_SYCC && numComps == 4) { numComps = 3; }
+#else
+ if (priv->image->color_space == OPJ_CLRSPC_SRGB && numComps == 4) { numComps = 3; }
+ else if (priv->image->color_space == OPJ_CLRSPC_SYCC && numComps == 4) { numComps = 3; }
+#endif
+ else if (numComps == 2) { numComps = 1; }
+ else if (numComps > 4) { numComps = 4; }
+ }
+ if (numComps == 3)
*csMode = streamCSDeviceRGB;
- else if (priv->image && priv->image->numcomps == 4)
+ else if (numComps == 4)
*csMode = streamCSDeviceCMYK;
else
*csMode = streamCSDeviceGray;
@@ -166,21 +195,45 @@ static void libopenjpeg_warning_callback(const char *msg, void * /*client_data*/
void JPXStream::init()
{
- Object oLen;
+ Object oLen, cspace, smaskInData;
if (getDict()) getDict()->lookup("Length", &oLen);
+ if (getDict()) getDict()->lookup("ColorSpace", &cspace);
+ if (getDict()) getDict()->lookup("SMaskInData", &smaskInData);
int bufSize = BUFFER_INITIAL_SIZE;
if (oLen.isInt()) bufSize = oLen.getInt();
oLen.free();
+ if (cspace.isArray() && cspace.arrayGetLength() > 0) {
+ Object cstype;
+ cspace.arrayGet(0, &cstype);
+ if (cstype.isName("Indexed")) priv->indexed = gTrue;
+ cstype.free();
+ }
+ cspace.free();
+
+ priv->smaskInData = 0;
+ if (smaskInData.isInt()) priv->smaskInData = smaskInData.getInt();
+ smaskInData.free();
+
int length = 0;
unsigned char *buf = str->toUnsignedChars(&length, bufSize);
- priv->init2(buf, length, CODEC_JP2);
+ priv->init2(buf, length, CODEC_JP2, priv->indexed);
free(buf);
if (priv->image) {
+ int numComps = (priv->image) ? priv->image->numcomps : 1;
+ int alpha = 0;
+ if (priv->image) {
+ if (priv->image->color_space == CLRSPC_SRGB && numComps == 4) { numComps = 3; alpha = 1; }
+ else if (priv->image->color_space == CLRSPC_SYCC && numComps == 4) { numComps = 3; alpha = 1; }
+ else if (numComps == 2) { numComps = 1; alpha = 1; }
+ else if (numComps > 4) { numComps = 4; alpha = 1; }
+ else { alpha = 0; }
+ }
priv->npixels = priv->image->comps[0].w * priv->image->comps[0].h;
priv->ncomps = priv->image->numcomps;
+ if (alpha == 1 && priv->smaskInData == 0) priv->ncomps--;
for (int component = 0; component < priv->ncomps; component++) {
if (priv->image->comps[component].data == NULL) {
close();
@@ -188,6 +241,7 @@ void JPXStream::init()
}
unsigned char *cdata = (unsigned char *)priv->image->comps[component].data;
int adjust = 0;
+ int depth = priv->image->comps[component].prec;
if (priv->image->comps[component].prec > 8)
adjust = priv->image->comps[component].prec - 8;
int sgndcorr = 0;
@@ -195,13 +249,7 @@ void JPXStream::init()
sgndcorr = 1 << (priv->image->comps[0].prec - 1);
for (int i = 0; i < priv->npixels; i++) {
int r = priv->image->comps[component].data[i];
- r += sgndcorr;
- if (adjust) {
- r = (r >> adjust)+((r >> (adjust-1))%2);
- if (unlikely(r > 255))
- r = 255;
- }
- *(cdata++) = r;
+ *(cdata++) = adjustComp(r, adjust, depth, sgndcorr, priv->indexed);
}
}
} else
@@ -212,7 +260,7 @@ void JPXStream::init()
priv->inited = gTrue;
}
-void JPXStreamPrivate::init2(unsigned char *buf, int bufLen, OPJ_CODEC_FORMAT format)
+void JPXStreamPrivate::init2(unsigned char *buf, int bufLen, OPJ_CODEC_FORMAT format, GBool indexed)
{
opj_cio_t *cio = NULL;
@@ -220,7 +268,8 @@ void JPXStreamPrivate::init2(unsigned char *buf, int bufLen, OPJ_CODEC_FORMAT fo
opj_dparameters_t parameters;
opj_set_default_decoder_parameters(&parameters);
#ifdef WITH_OPENJPEG_IGNORE_PCLR_CMAP_CDEF_FLAG
- parameters.flags = OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
+ if (indexed)
+ parameters.flags = OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
#endif
/* Configure the event manager to receive errors and warnings */
@@ -254,10 +303,10 @@ void JPXStreamPrivate::init2(unsigned char *buf, int bufLen, OPJ_CODEC_FORMAT fo
error:
if (format == CODEC_JP2) {
error(errSyntaxWarning, -1, "Did not succeed opening JPX Stream as JP2, trying as J2K.");
- init2(buf, bufLen, CODEC_J2K);
+ init2(buf, bufLen, CODEC_J2K, indexed);
} else if (format == CODEC_J2K) {
error(errSyntaxWarning, -1, "Did not succeed opening JPX Stream as J2K, trying as JPT.");
- init2(buf, bufLen, CODEC_JPT);
+ init2(buf, bufLen, CODEC_JPT, indexed);
} else {
error(errSyntaxError, -1, "Did not succeed opening JPX Stream.");
}
@@ -313,21 +362,45 @@ static OPJ_BOOL jpxSeek_callback(OPJ_OFF_T seek_pos, void * p_user_data)
void JPXStream::init()
{
- Object oLen;
+ Object oLen, cspace, smaskInData;
if (getDict()) getDict()->lookup("Length", &oLen);
+ if (getDict()) getDict()->lookup("ColorSpace", &cspace);
+ if (getDict()) getDict()->lookup("SMaskInData", &smaskInData);
int bufSize = BUFFER_INITIAL_SIZE;
if (oLen.isInt()) bufSize = oLen.getInt();
oLen.free();
+ if (cspace.isArray() && cspace.arrayGetLength() > 0) {
+ Object cstype;
+ cspace.arrayGet(0, &cstype);
+ if (cstype.isName("Indexed")) priv->indexed = gTrue;
+ cstype.free();
+ }
+ cspace.free();
+
+ priv->smaskInData = 0;
+ if (smaskInData.isInt()) priv->smaskInData = smaskInData.getInt();
+ smaskInData.free();
+
int length = 0;
unsigned char *buf = str->toUnsignedChars(&length, bufSize);
- priv->init2(OPJ_CODEC_JP2, buf, length);
+ priv->init2(OPJ_CODEC_JP2, buf, length, priv->indexed);
gfree(buf);
if (priv->image) {
+ int numComps = (priv->image) ? priv->image->numcomps : 1;
+ int alpha = 0;
+ if (priv->image) {
+ if (priv->image->color_space == OPJ_CLRSPC_SRGB && numComps == 4) { numComps = 3; alpha = 1; }
+ else if (priv->image->color_space == OPJ_CLRSPC_SYCC && numComps == 4) { numComps = 3; alpha = 1; }
+ else if (numComps == 2) { numComps = 1; alpha = 1; }
+ else if (numComps > 4) { numComps = 4; alpha = 1; }
+ else { alpha = 0; }
+ }
priv->npixels = priv->image->comps[0].w * priv->image->comps[0].h;
priv->ncomps = priv->image->numcomps;
+ if (alpha == 1 && priv->smaskInData == 0) priv->ncomps--;
for (int component = 0; component < priv->ncomps; component++) {
if (priv->image->comps[component].data == NULL) {
close();
@@ -335,6 +408,7 @@ void JPXStream::init()
}
unsigned char *cdata = (unsigned char *)priv->image->comps[component].data;
int adjust = 0;
+ int depth = priv->image->comps[component].prec;
if (priv->image->comps[component].prec > 8)
adjust = priv->image->comps[component].prec - 8;
int sgndcorr = 0;
@@ -342,13 +416,7 @@ void JPXStream::init()
sgndcorr = 1 << (priv->image->comps[0].prec - 1);
for (int i = 0; i < priv->npixels; i++) {
int r = priv->image->comps[component].data[i];
- r += sgndcorr;
- if (adjust) {
- r = (r >> adjust)+((r >> (adjust-1))%2);
- if (unlikely(r > 255))
- r = 255;
- }
- *(cdata++) = r;
+ *(cdata++) = adjustComp(r, adjust, depth, sgndcorr, priv->indexed);
}
}
} else {
@@ -360,7 +428,7 @@ void JPXStream::init()
priv->inited = gTrue;
}
-void JPXStreamPrivate::init2(OPJ_CODEC_FORMAT format, unsigned char *buf, int length)
+void JPXStreamPrivate::init2(OPJ_CODEC_FORMAT format, unsigned char *buf, int length, GBool indexed)
{
JPXData jpxData;
@@ -389,7 +457,8 @@ void JPXStreamPrivate::init2(OPJ_CODEC_FORMAT format, unsigned char *buf, int le
/* Use default decompression parameters */
opj_dparameters_t parameters;
opj_set_default_decoder_parameters(&parameters);
- parameters.flags |= OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
+ if (indexed)
+ parameters.flags |= OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
/* Get the decoder handle of the format */
decoder = opj_create_decompress(format);
@@ -438,10 +507,10 @@ error:
opj_destroy_codec(decoder);
if (format == OPJ_CODEC_JP2) {
error(errSyntaxWarning, -1, "Did no succeed opening JPX Stream as JP2, trying as J2K.");
- init2(OPJ_CODEC_J2K, buf, length);
+ init2(OPJ_CODEC_J2K, buf, length, indexed);
} else if (format == OPJ_CODEC_J2K) {
error(errSyntaxWarning, -1, "Did no succeed opening JPX Stream as J2K, trying as JPT.");
- init2(OPJ_CODEC_JPT, buf, length);
+ init2(OPJ_CODEC_JPT, buf, length, indexed);
} else {
error(errSyntaxError, -1, "Did no succeed opening JPX Stream.");
}
diff --git a/Build/source/libs/poppler/poppler-src/poppler/Makefile.am b/Build/source/libs/poppler/poppler-src/poppler/Makefile.am
index 79b6000d244..df64dbfa4cf 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/Makefile.am
+++ b/Build/source/libs/poppler/poppler-src/poppler/Makefile.am
@@ -78,18 +78,42 @@ libjpeg2000_sources = \
endif
+if BUILD_NSS
+
+nss_sources = \
+ SignatureHandler.cc
+
+nss_libs = \
+ $(NSS3_LIBS)
+
+nss_includes = \
+ $(NSS3_CFLAGS)
+
+nss_headers = \
+ SignatureHandler.h
+
+endif
+
if BUILD_ZLIB
zlib_sources = \
- FlateStream.h \
- FlateStream.cc
+ FlateEncoder.h \
+ FlateEncoder.cc
zlib_libs = \
$(ZLIB_LIBS)
endif
+if BUILD_ZLIB_UNCOMPRESS
+
+zlib_uncompress_sources = \
+ FlateStream.h \
+ FlateStream.cc
+
+endif
+
if BUILD_LIBCURL
libcurl_libs = \
@@ -119,6 +143,7 @@ poppler_includedir = $(includedir)/poppler
poppler_include_HEADERS = \
$(splash_headers) \
$(curl_headers) \
+ $(nss_headers) \
Annot.h \
Array.h \
BuiltinFont.h \
@@ -166,6 +191,7 @@ poppler_include_HEADERS = \
PreScanOutputDev.h \
PSTokenizer.h \
Rendition.h \
+ SignatureInfo.h \
StdinCachedFile.h \
StdinPDFDocBuilder.h \
Stream-CCITT.h \
@@ -200,6 +226,8 @@ libpoppler_la_SOURCES = \
$(splash_sources) \
$(libjpeg_sources) \
$(zlib_sources) \
+ $(zlib_uncompress_sources) \
+ $(nss_sources) \
$(libjpeg2000_sources) \
$(curl_sources) \
Annot.cc \
@@ -247,6 +275,7 @@ libpoppler_la_SOURCES = \
PreScanOutputDev.cc \
PSTokenizer.cc \
Rendition.cc \
+ SignatureInfo.cc \
StdinCachedFile.cc \
StdinPDFDocBuilder.cc \
Stream.cc \
@@ -275,6 +304,7 @@ libpoppler_la_CPPFLAGS = \
$(libjpeg2000_includes) \
$(libpng_includes) \
$(libcurl_includes) \
+ $(nss_includes) \
$(FREETYPE_CFLAGS) \
$(FONTCONFIG_CFLAGS) \
$(AM_CPPFLAGS)
@@ -289,6 +319,7 @@ libpoppler_la_LIBADD = \
$(libpng_libs) \
$(zlib_libs) \
$(libcurl_libs) \
+ $(nss_libs) \
$(libjpeg2000_libs) \
$(FREETYPE_LIBS) \
$(FONTCONFIG_LIBS) \
@@ -296,7 +327,7 @@ libpoppler_la_LIBADD = \
$(win32_libs)
libpoppler_la_LDFLAGS = \
- -version-info 58:0:0 \
+ -version-info 59:0:0 \
@create_shared_lib@ \
@auto_import_flags@
diff --git a/Build/source/libs/poppler/poppler-src/poppler/Object.h b/Build/source/libs/poppler/poppler-src/poppler/Object.h
index 2a3766288a6..c8fda624d8c 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/Object.h
+++ b/Build/source/libs/poppler/poppler-src/poppler/Object.h
@@ -50,7 +50,14 @@
abort(); \
}
-#define OBJECT_3TYPES_CHECK(wanted_type1, wanted_type2, wanted_type3) \
+#define OBJECT_2TYPES_CHECK(wanted_type1, wanted_type2) \
+ if (unlikely(type != wanted_type1) && unlikely(type != wanted_type2)) { \
+ error(errInternal, 0, "Call to Object where the object was type {0:d}, " \
+ "not the expected type {1:d} or {2:d}", type, wanted_type1, wanted_type2); \
+ abort(); \
+ }
+
+#define OBJECT_3TYPES_CHECK(wanted_type1, wanted_type2, wanted_type3) \
if (unlikely(type != wanted_type1) && unlikely(type != wanted_type2) && unlikely(type != wanted_type3)) { \
error(errInternal, 0, "Call to Object where the object was type {0:d}, " \
"not the expected type {1:d}, {2:d} or {3:d}", type, wanted_type1, wanted_type2, wanted_type3); \
@@ -181,6 +188,7 @@ public:
GBool isEOF() { return type == objEOF; }
GBool isNone() { return type == objNone; }
GBool isInt64() { return type == objInt64; }
+ GBool isIntOrInt64() { return type == objInt || type == objInt64; }
// Special type checking.
GBool isName(const char *nameA)
@@ -213,6 +221,8 @@ public:
int getRefGen() { OBJECT_TYPE_CHECK(objRef); return ref.gen; }
char *getCmd() { OBJECT_TYPE_CHECK(objCmd); return cmd; }
long long getInt64() { OBJECT_TYPE_CHECK(objInt64); return int64g; }
+ long long getIntOrInt64() { OBJECT_2TYPES_CHECK(objInt, objInt64);
+ return type == objInt ? intg : int64g; }
// Array accessors.
int arrayGetLength();
diff --git a/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc b/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc
index 8287060ae6c..f052772ec08 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc
+++ b/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005, 2006, 2008 Brad Hards <bradh@frogmouth.net>
-// Copyright (C) 2005, 2007-2009, 2011-2014 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2005, 2007-2009, 2011-2015 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2008 Julien Rebetez <julienr@svn.gnome.org>
// Copyright (C) 2008, 2010 Pino Toscano <pino@kde.org>
// Copyright (C) 2008, 2010, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -32,6 +32,8 @@
// Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com>
// Copyright (C) 2014 Bogdan Cristea <cristeab@gmail.com>
// Copyright (C) 2015 Li Junling <lijunling@sina.com>
+// Copyright (C) 2015 André Guerreiro <aguerreiro1985@gmail.com>
+// Copyright (C) 2015 André Esser <bepandre@hotmail.com>
//
// 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
@@ -452,6 +454,27 @@ GBool PDFDoc::checkEncryption(GooString *ownerPassword, GooString *userPassword)
return ret;
}
+std::vector<FormWidgetSignature*> PDFDoc::getSignatureWidgets()
+{
+ int num_pages = getNumPages();
+ FormPageWidgets *page_widgets = NULL;
+ std::vector<FormWidgetSignature*> widget_vector;
+
+ for (int i = 1; i <= num_pages; i++) {
+ Page *p = getCatalog()->getPage(i);
+ if (p) {
+ page_widgets = p->getFormWidgets();
+ for (int j = 0; page_widgets != NULL && j < page_widgets->getNumWidgets(); j++) {
+ if (page_widgets->getWidget(j)->getType() == formSignature) {
+ widget_vector.push_back(static_cast<FormWidgetSignature*>(page_widgets->getWidget(j)));
+ }
+ }
+ delete page_widgets;
+ }
+ }
+ return widget_vector;
+}
+
void PDFDoc::displayPage(OutputDev *out, int page,
double hDPI, double vDPI, int rotate,
GBool useMediaBox, GBool crop, GBool printing,
diff --git a/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.h b/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.h
index 6c40f7b0c0c..0bb15c4b3e6 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.h
+++ b/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.h
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005, 2006, 2008 Brad Hards <bradh@frogmouth.net>
-// Copyright (C) 2005, 2009, 2014 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2005, 2009, 2014, 2015 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2008 Julien Rebetez <julienr@svn.gnome.org>
// Copyright (C) 2008 Pino Toscano <pino@kde.org>
// Copyright (C) 2008 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -27,6 +27,8 @@
// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com>
// Copyright (C) 2013 Adrian Perez de Castro <aperez@igalia.com>
+// Copyright (C) 2015 André Guerreiro <aguerreiro1985@gmail.com>
+// Copyright (C) 2015 André Esser <bepandre@hotmail.com>
//
// 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
@@ -47,6 +49,7 @@
#include "Catalog.h"
#include "Page.h"
#include "Annot.h"
+#include "Form.h"
#include "OptionalContent.h"
#include "Stream.h"
@@ -199,6 +202,8 @@ public:
// Is the file encrypted?
GBool isEncrypted() { return xref->isEncrypted(); }
+ std::vector<FormWidgetSignature*> getSignatureWidgets();
+
// Check various permissions.
GBool okToPrint(GBool ignoreOwnerPW = gFalse)
{ return xref->okToPrint(ignoreOwnerPW); }
diff --git a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc
index 2d01edbd2b7..a260727bf44 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc
+++ b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc
@@ -2,7 +2,7 @@
//
// PSOutputDev.cc
//
-// Copyright 1996-2003 Glyph & Cog, LLC
+// Copyright 1996-2013 Glyph & Cog, LLC
//
//========================================================================
@@ -23,7 +23,7 @@
// Copyright (C) 2009-2013 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2009 Till Kamppeter <till.kamppeter@gmail.com>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
-// Copyright (C) 2009, 2011, 2012, 2014, 2015 William Bader <williambader@hotmail.com>
+// Copyright (C) 2009, 2011, 2012, 2014-2016 William Bader <williambader@hotmail.com>
// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net>
// Copyright (C) 2009-2011, 2013-2015 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2012, 2014 Fabio D'Urso <fabiodurso@hotmail.it>
@@ -65,6 +65,12 @@
#include "Catalog.h"
#include "Page.h"
#include "Stream.h"
+#if ENABLE_ZLIB
+# include "FlateEncoder.h"
+#endif
+#if ENABLE_ZLIB_UNCOMPRESS
+# include "FlateStream.h"
+#endif
#include "Annot.h"
#include "XRef.h"
#include "PreScanOutputDev.h"
@@ -1243,6 +1249,8 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA,
generateOPI = gFalse;
useASCIIHex = gFalse;
useBinary = gFalse;
+ enableLZW = gTrue;
+ enableFlate = gTrue;
rasterMono = gFalse;
rasterResolution = 300;
uncompressPreloadedImages = gFalse;
@@ -2953,7 +2961,7 @@ void PSOutputDev::setupImages(Dict *resDict) {
}
void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
- GBool useRLE, useCompressed, doUseASCIIHex;
+ GBool useFlate, useLZW, useRLE, useCompressed, doUseASCIIHex;
GooString *s;
int c;
int size, line, col, i;
@@ -2962,23 +2970,29 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
// filters
//~ this does not correctly handle the DeviceN color space
//~ -- need to use DeviceNRecoder
+
+ useFlate = useLZW = useRLE = gFalse;
+ useCompressed = gFalse;
+ doUseASCIIHex = gFalse;
+
if (level < psLevel2) {
- useRLE = gFalse;
- useCompressed = gFalse;
doUseASCIIHex = gTrue;
} else {
if (uncompressPreloadedImages) {
- useRLE = gFalse;
- useCompressed = gFalse;
+ /* nothing to do */;
} else {
s = str->getPSFilter(level < psLevel3 ? 2 : 3, "");
if (s) {
- useRLE = gFalse;
useCompressed = gTrue;
delete s;
} else {
- useRLE = gTrue;
- useCompressed = gFalse;
+ if (level >= psLevel3 && getEnableFlate()) {
+ useFlate = gTrue;
+ } else if (getEnableLZW()) {
+ useLZW = gTrue;
+ } else {
+ useRLE = gTrue;
+ }
}
}
doUseASCIIHex = useASCIIHex;
@@ -2986,7 +3000,14 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
if (useCompressed) {
str = str->getUndecodedStream();
}
- if (useRLE) {
+#if ENABLE_ZLIB
+ if (useFlate) {
+ str = new FlateEncoder(str);
+ } else
+#endif
+ if (useLZW) {
+ str = new LZWEncoder(str);
+ } else if (useRLE) {
str = new RunLengthEncoder(str);
}
if (doUseASCIIHex) {
@@ -3028,9 +3049,9 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
}
} while (c != (doUseASCIIHex ? '>' : '~') && c != EOF);
// add one entry for the final line of data; add another entry
- // because the RunLengthDecode filter may read past the end
+ // because the LZWDecode/RunLengthDecode filter may read past the end
++size;
- if (useRLE) {
+ if (useLZW || useRLE) {
++size;
}
outerSize = size/65535 + 1;
@@ -3090,7 +3111,7 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
}
if (c == (doUseASCIIHex ? '>' : '~') || c == EOF) {
writePS((char *)(doUseASCIIHex ? "> put\n" : "~> put\n"));
- if (useRLE) {
+ if (useLZW || useRLE) {
++line;
writePSFmt("{0:d} <> put\n", line);
} else {
@@ -3231,6 +3252,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
PreScanOutputDev *scan;
GBool rasterize;
#if HAVE_SPLASH
+ GBool useFlate, useLZW;
SplashOutputDev *splashOut;
SplashColor paperColor;
PDFRectangle box;
@@ -3269,6 +3291,9 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
}
#if HAVE_SPLASH
+ // get the rasterization parameters
+ useFlate = getEnableFlate() && level >= psLevel3;
+ useLZW = getEnableLZW();
// start the PS page
page->makeBox(rasterResolution, rasterResolution, rotateA, useMediaBox, gFalse,
sliceX, sliceY, sliceW, sliceH, &box, &crop);
@@ -3579,14 +3604,39 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
isGray = gFalse;
}
str0->reset();
- if (isGray && numComps == 4) {
- str = new RunLengthEncoder(new CMYKGrayEncoder(str0));
- numComps = 1;
- } else if (isGray && numComps == 3) {
- str = new RunLengthEncoder(new RGBGrayEncoder(str0));
- numComps = 1;
+#if ENABLE_ZLIB
+ if (useFlate) {
+ if (isGray && numComps == 4) {
+ str = new FlateEncoder(new CMYKGrayEncoder(str0));
+ numComps = 1;
+ } else if (isGray && numComps == 3) {
+ str = new FlateEncoder(new RGBGrayEncoder(str0));
+ numComps = 1;
+ } else {
+ str = new FlateEncoder(str0);
+ }
+ } else
+#endif
+ if (useLZW) {
+ if (isGray && numComps == 4) {
+ str = new LZWEncoder(new CMYKGrayEncoder(str0));
+ numComps = 1;
+ } else if (isGray && numComps == 3) {
+ str = new LZWEncoder(new RGBGrayEncoder(str0));
+ numComps = 1;
+ } else {
+ str = new LZWEncoder(str0);
+ }
} else {
- str = new RunLengthEncoder(str0);
+ if (isGray && numComps == 4) {
+ str = new RunLengthEncoder(new CMYKGrayEncoder(str0));
+ numComps = 1;
+ } else if (isGray && numComps == 3) {
+ str = new RunLengthEncoder(new RGBGrayEncoder(str0));
+ numComps = 1;
+ } else {
+ str = new RunLengthEncoder(str0);
+ }
}
if (numComps == 1) {
writePS("/DeviceGray setcolorspace\n");
@@ -3615,7 +3665,13 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
} else {
writePS(" /ASCII85Decode filter\n");
}
- writePS(" /RunLengthDecode filter\n");
+ if (useFlate) {
+ writePS(" /FlateDecode filter\n");
+ } else if (useLZW) {
+ writePS(" /LZWDecode filter\n");
+ } else {
+ writePS(" /RunLengthDecode filter\n");
+ }
writePS(">>\n");
if (useBinary) {
/* nothing to do */;
@@ -4349,7 +4405,7 @@ void PSOutputDev::restoreTextPos(GfxState *state) {
void PSOutputDev::stroke(GfxState *state) {
doPath(state->getPath());
if (inType3Char && t3FillColorOnly) {
- // if we're construct a cacheable Type 3 glyph, we need to do
+ // if we're constructing a cacheable Type 3 glyph, we need to do
// everything in the fill color
writePS("Sf\n");
} else {
@@ -5651,7 +5707,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
GBool emitRect, addRect, extendRect;
GooString *s;
int n, numComps;
- GBool useRLE, useASCII, useCompressed;
+ GBool useLZW, useRLE, useASCII, useCompressed;
GfxSeparationColorSpace *sepCS;
GfxColor color;
GfxCMYK cmyk;
@@ -5835,7 +5891,11 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
if (inlineImg) {
// create an array
str2 = new FixedLengthEncoder(str, len);
- str2 = new RunLengthEncoder(str2);
+ if (getEnableLZW()) {
+ str2 = new LZWEncoder(str2);
+ } else {
+ str2 = new RunLengthEncoder(str2);
+ }
if (useASCIIHex) {
str2 = new ASCIIHexEncoder(str2);
} else {
@@ -5878,7 +5938,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
}
} while (c != (useASCIIHex ? '>' : '~') && c != EOF);
writePS((char *)(useASCIIHex ? ">\n" : "~>\n"));
- // add an extra entry because the RunLengthDecode filter may
+ // add an extra entry because the LZWDecode/RunLengthDecode filter may
// read past the end
writePS("<>]\n");
writePS("0\n");
@@ -5956,7 +6016,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
if ((mode == psModeForm || inType3Char || preloadImagesForms) &&
uncompressPreloadedImages) {
s = NULL;
- useRLE = gFalse;
+ useLZW = useRLE = gFalse;
useCompressed = gFalse;
useASCII = gFalse;
} else {
@@ -5964,11 +6024,17 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
" ");
if ((colorMap && colorMap->getColorSpace()->getMode() == csDeviceN) ||
inlineImg || !s) {
- useRLE = gTrue;
+ if (getEnableLZW()) {
+ useLZW = gTrue;
+ useRLE = gFalse;
+ } else {
+ useRLE = gTrue;
+ useLZW = gFalse;
+ }
useASCII = !(mode == psModeForm || inType3Char || preloadImagesForms);
useCompressed = gFalse;
} else {
- useRLE = gFalse;
+ useLZW = useRLE = gFalse;
useASCII = str->isBinary() &&
!(mode == psModeForm || inType3Char || preloadImagesForms);
useCompressed = gTrue;
@@ -5978,7 +6044,9 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
writePSFmt(" /ASCII{0:s}Decode filter\n",
useASCIIHex ? "Hex" : "85");
}
- if (useRLE) {
+ if (useLZW) {
+ writePS(" /LZWDecode filter\n");
+ } else if (useRLE) {
writePS(" /RunLengthDecode filter\n");
}
if (useCompressed) {
@@ -6011,8 +6079,10 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
str = new DeviceNRecoder(str, width, height, colorMap);
}
- // add RunLengthEncode and ASCIIHex/85 encode filters
- if (useRLE) {
+ // add LZWEncode/RunLengthEncode and ASCIIHex/85 encode filters
+ if (useLZW) {
+ str = new LZWEncoder(str);
+ } else if (useRLE) {
str = new RunLengthEncoder(str);
}
if (useASCII) {
@@ -6033,7 +6103,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
n = 0;
} else {
// need to read the stream to count characters -- the length
- // is data-dependent (because of ASCII and RLE filters)
+ // is data-dependent (because of ASCII and LZW/RLE filters)
str->reset();
n = 0;
while ((c = str->getChar()) != EOF) {
@@ -6085,7 +6155,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
#endif
// delete encoders
- if (useRLE || useASCII || inlineImg) {
+ if (useLZW || useRLE || useASCII || inlineImg) {
delete str;
}
}
@@ -6108,8 +6178,8 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
Stream *str2;
GooString *s;
int n, numComps;
- GBool useRLE, useASCII, useCompressed;
- GBool maskUseRLE, maskUseASCII, maskUseCompressed;
+ GBool useFlate, useLZW, useRLE, useASCII, useCompressed;
+ GBool maskUseFlate, maskUseLZW, maskUseRLE, maskUseASCII, maskUseCompressed;
GooString *maskFilters;
GfxSeparationColorSpace *sepCS;
GfxColor color;
@@ -6117,8 +6187,8 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
int c;
int col, i;
- useRLE = useASCII = useCompressed = gFalse; // make gcc happy
- maskUseRLE = maskUseASCII = maskUseCompressed = gFalse; // make gcc happy
+ useFlate = useLZW = useRLE = useASCII = useCompressed = gFalse;
+ maskUseFlate = maskUseLZW = maskUseRLE = maskUseASCII = maskUseCompressed = gFalse;
maskFilters = NULL; // make gcc happy
// explicit masking
@@ -6128,17 +6198,18 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
if ((mode == psModeForm || inType3Char || preloadImagesForms) &&
uncompressPreloadedImages) {
s = NULL;
- maskUseRLE = gFalse;
- maskUseCompressed = gFalse;
- maskUseASCII = gFalse;
} else {
s = maskStr->getPSFilter(3, " ");
if (!s) {
- maskUseRLE = gTrue;
+ if (getEnableFlate()) {
+ maskUseFlate = gTrue;
+ } else if (getEnableLZW()) {
+ maskUseLZW = gTrue;
+ } else {
+ maskUseRLE = gTrue;
+ }
maskUseASCII = !(mode == psModeForm || inType3Char || preloadImagesForms);
- maskUseCompressed = gFalse;
} else {
- maskUseRLE = gFalse;
maskUseASCII = maskStr->isBinary() &&
!(mode == psModeForm || inType3Char || preloadImagesForms);
maskUseCompressed = gTrue;
@@ -6149,7 +6220,11 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
maskFilters->appendf(" /ASCII{0:s}Decode filter\n",
useASCIIHex ? "Hex" : "85");
}
- if (maskUseRLE) {
+ if (maskUseFlate) {
+ maskFilters->append(" /FlateDecode filter\n");
+ } else if (maskUseLZW) {
+ maskFilters->append(" /LZWDecode filter\n");
+ } else if (maskUseRLE) {
maskFilters->append(" /RunLengthDecode filter\n");
}
if (maskUseCompressed) {
@@ -6166,11 +6241,18 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
writePS(maskFilters->getCString());
writePS("pdfMask\n");
- // add RunLengthEncode and ASCIIHex/85 encode filters
+ // add FlateEncode/LZWEncode/RunLengthEncode and ASCIIHex/85 encode filters
if (maskUseCompressed) {
maskStr = maskStr->getUndecodedStream();
}
- if (maskUseRLE) {
+#if ENABLE_ZLIB
+ if (maskUseFlate) {
+ maskStr = new FlateEncoder(maskStr);
+ } else
+#endif
+ if (maskUseLZW) {
+ maskStr = new LZWEncoder(maskStr);
+ } else if (maskUseRLE) {
maskStr = new RunLengthEncoder(maskStr);
}
if (maskUseASCII) {
@@ -6191,7 +6273,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
writePS("%-EOD-\n");
// delete encoders
- if (maskUseRLE || maskUseASCII) {
+ if (maskUseFlate || maskUseLZW || maskUseRLE || maskUseASCII) {
delete maskStr;
}
}
@@ -6208,7 +6290,16 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
if (inlineImg) {
// create an array
str2 = new FixedLengthEncoder(str, len);
- str2 = new RunLengthEncoder(str2);
+#if ENABLE_ZLIB
+ if (getEnableFlate()) {
+ str2 = new FlateEncoder(str2);
+ } else
+#endif
+ if (getEnableLZW()) {
+ str2 = new LZWEncoder(str2);
+ } else {
+ str2 = new RunLengthEncoder(str2);
+ }
if (useASCIIHex) {
str2 = new ASCIIHexEncoder(str2);
} else {
@@ -6251,7 +6342,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
}
} while (c != (useASCIIHex ? '>' : '~') && c != EOF);
writePS((char *)(useASCIIHex ? ">\n" : "~>\n"));
- // add an extra entry because the RunLengthDecode filter may
+ // add an extra entry because the FlateEncode/LZWDecode/RunLengthDecode filter may
// read past the end
writePS("<>]\n");
writePS("0\n");
@@ -6334,22 +6425,28 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
}
// filters
+
+ useFlate = useLZW = useRLE = gFalse;
+ useCompressed = gFalse;
+ useASCII = gFalse;
+
if ((mode == psModeForm || inType3Char || preloadImagesForms) &&
uncompressPreloadedImages) {
s = NULL;
- useRLE = gFalse;
- useCompressed = gFalse;
- useASCII = gFalse;
} else {
s = str->getPSFilter(level < psLevel2 ? 1 : level < psLevel3 ? 2 : 3,
" ");
if ((colorMap && colorMap->getColorSpace()->getMode() == csDeviceN) ||
inlineImg || !s) {
- useRLE = gTrue;
+ if (getEnableFlate()) {
+ useFlate = gTrue;
+ } else if (getEnableLZW()) {
+ useLZW = gTrue;
+ } else {
+ useRLE = gTrue;
+ }
useASCII = !(mode == psModeForm || inType3Char || preloadImagesForms);
- useCompressed = gFalse;
} else {
- useRLE = gFalse;
useASCII = str->isBinary() &&
!(mode == psModeForm || inType3Char || preloadImagesForms);
useCompressed = gTrue;
@@ -6359,7 +6456,11 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
writePSFmt(" /ASCII{0:s}Decode filter\n",
useASCIIHex ? "Hex" : "85");
}
- if (useRLE) {
+ if (useFlate) {
+ writePS(" /FlateDecode filter\n");
+ } else if (useLZW) {
+ writePS(" /LZWDecode filter\n");
+ } else if (useRLE) {
writePS(" /RunLengthDecode filter\n");
}
if (useCompressed) {
@@ -6435,8 +6536,15 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
str = str->getUndecodedStream();
}
- // add RunLengthEncode and ASCIIHex/85 encode filters
- if (useRLE) {
+ // add FlateEncode/LZWEncode/RunLengthEncode and ASCIIHex/85 encode filters
+#if ENABLE_ZLIB
+ if (useFlate) {
+ str = new FlateEncoder(str);
+ } else
+#endif
+ if (useLZW) {
+ str = new LZWEncoder(str);
+ } else if (useRLE) {
str = new RunLengthEncoder(str);
}
if (useASCII) {
@@ -6459,7 +6567,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
writePS("%-EOD-\n");
// delete encoders
- if (useRLE || useASCII || inlineImg) {
+ if (useFlate || useLZW || useRLE || useASCII || inlineImg) {
delete str;
}
}
diff --git a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h
index 7318cafdf2a..3aea22309bb 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h
+++ b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h
@@ -20,7 +20,7 @@
// Copyright (C) 2009-2013 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2009 Till Kamppeter <till.kamppeter@gmail.com>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
-// Copyright (C) 2009, 2011, 2015 William Bader <williambader@hotmail.com>
+// Copyright (C) 2009, 2011, 2015-2016 William Bader <williambader@hotmail.com>
// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
// Copyright (C) 2011, 2014 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
@@ -320,6 +320,13 @@ public:
GBool getEmbedCIDTrueType() const { return embedCIDTrueType; }
GBool getFontPassthrough() const { return fontPassthrough; }
GBool getOptimizeColorSpace() const { return optimizeColorSpace; }
+ GBool getEnableLZW() const { return enableLZW; };
+ GBool getEnableFlate() const
+#if ENABLE_ZLIB
+ { return enableFlate; }
+#else
+ { return gFalse; }
+#endif
void setEmbedType1(GBool b) { embedType1 = b; }
void setEmbedTrueType(GBool b) { embedTrueType = b; }
void setEmbedCIDPostScript(GBool b) { embedCIDPostScript = b; }
@@ -330,6 +337,8 @@ public:
void setGenerateOPI(GBool b) { generateOPI = b; }
void setUseASCIIHex(GBool b) { useASCIIHex = b; }
void setUseBinary(GBool b) { useBinary = b; }
+ void setEnableLZW(GBool b) { enableLZW = b; }
+ void setEnableFlate(GBool b) { enableFlate = b; }
private:
@@ -532,6 +541,8 @@ private:
GBool generateOPI; // generate PostScript OPI comments?
GBool useASCIIHex; // use ASCIIHex instead of ASCII85?
GBool useBinary; // use binary instead of hex
+ GBool enableLZW; // enable LZW compression
+ GBool enableFlate; // enable Flate compression
#if OPI_SUPPORT
int opi13Nest; // nesting level of OPI 1.3 objects
diff --git a/Build/source/libs/poppler/poppler-src/poppler/SecurityHandler.cc b/Build/source/libs/poppler/poppler-src/poppler/SecurityHandler.cc
index 63d8b4e1287..9e0546e39d5 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/SecurityHandler.cc
+++ b/Build/source/libs/poppler/poppler-src/poppler/SecurityHandler.cc
@@ -16,6 +16,7 @@
// Copyright (C) 2010, 2012, 2015 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2014 Fabio D'Urso <fabiodurso@hotmail.it>
+// Copyright (C) 2016 Alok Anand <alok4nand@gmail.com>
//
// 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
@@ -186,7 +187,7 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA,
if ((encRevision <= 4 &&
ownerKeyObj.getString()->getLength() == 32 &&
userKeyObj.getString()->getLength() == 32) ||
- (encRevision == 5 &&
+ ((encRevision == 5 || encRevision == 6) &&
// the spec says 48 bytes, but Acrobat pads them out longer
ownerKeyObj.getString()->getLength() >= 48 &&
userKeyObj.getString()->getLength() >= 48 &&
@@ -208,7 +209,7 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA,
//~ doesn't handle the case where StmF, StrF, and EFF are not all the
//~ same)
if ((encVersion == 4 || encVersion == 5) &&
- (encRevision == 4 || encRevision == 5)) {
+ (encRevision == 4 || encRevision == 5 || encRevision == 6)) {
encryptDictA->dictLookup("CF", &cryptFiltersObj);
encryptDictA->dictLookup("StmF", &streamFilterObj);
encryptDictA->dictLookup("StrF", &stringFilterObj);
@@ -244,7 +245,7 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA,
cfLengthObj.free();
} else if (cfmObj.isName("AESV3")) {
encVersion = 5;
- encRevision = 5;
+ // let encRevision be 5 or 6
encAlgorithm = cryptAES256;
if (cryptFilterObj.dictLookup("Length",
&cfLengthObj)->isInt()) {
@@ -286,7 +287,7 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA,
fileKeyLength = 16;
}
ok = gTrue;
- } else if (encVersion == 5 && encRevision == 5) {
+ } else if (encVersion == 5 && (encRevision == 5 || encRevision == 6)) {
fileID = new GooString(); // unused for V=R=5
if (ownerEncObj.isString() && userEncObj.isString()) {
ownerEnc = ownerEncObj.getString()->copy();
diff --git a/Build/source/libs/poppler/poppler-src/poppler/SignatureHandler.cc b/Build/source/libs/poppler/poppler-src/poppler/SignatureHandler.cc
new file mode 100644
index 00000000000..96de8f3266a
--- /dev/null
+++ b/Build/source/libs/poppler/poppler-src/poppler/SignatureHandler.cc
@@ -0,0 +1,339 @@
+//========================================================================
+//
+// SignatureHandler.cc
+//
+// This file is licensed under the GPLv2 or later
+//
+// Copyright 2015, 2016 André Guerreiro <aguerreiro1985@gmail.com>
+// Copyright 2015 André Esser <bepandre@hotmail.com>
+// Copyright 2015 Albert Astals Cid <aacid@kde.org>
+// Copyright 2015 Markus Kilås <digital@markuspage.com>
+//
+//========================================================================
+
+#include <config.h>
+
+#include "SignatureHandler.h"
+#include "goo/gmem.h"
+#include <secmod.h>
+
+#include <dirent.h>
+#include <Error.h>
+
+unsigned int SignatureHandler::digestLength(SECOidTag digestAlgId)
+{
+ switch(digestAlgId){
+ case SEC_OID_SHA1:
+ return 20;
+ case SEC_OID_SHA256:
+ return 32;
+ case SEC_OID_SHA384:
+ return 48;
+ case SEC_OID_SHA512:
+ return 64;
+ default:
+ printf("ERROR: Unrecognized Hash ID\n");
+ return 0;
+ }
+}
+
+char *SignatureHandler::getSignerName()
+{
+ if (!CMSSignerInfo)
+ return NULL;
+
+ CERTCertificate *cert = NSS_CMSSignerInfo_GetSigningCertificate(CMSSignerInfo, CERT_GetDefaultCertDB());
+ return CERT_GetCommonName(&cert->subject);
+}
+
+time_t SignatureHandler::getSigningTime()
+{
+ PRTime sTime; // time in microseconds since the epoch
+
+ if (NSS_CMSSignerInfo_GetSigningTime (CMSSignerInfo, &sTime) != SECSuccess)
+ return 0;
+
+ return (time_t) sTime/1000000;
+}
+
+
+GooString *SignatureHandler::getDefaultFirefoxCertDB_Linux()
+{
+ GooString * finalPath = NULL;
+ DIR *toSearchIn;
+ struct dirent *subFolder;
+
+ GooString * homePath = new GooString(getenv("HOME"));
+ homePath = homePath->append("/.mozilla/firefox/");
+
+ if ((toSearchIn = opendir(homePath->getCString())) == NULL) {
+ error(errInternal, 0, "couldn't find default Firefox Folder");
+ delete homePath;
+ return NULL;
+ }
+ do {
+ if ((subFolder = readdir(toSearchIn)) != NULL) {
+ if (strstr(subFolder->d_name, "default") != NULL) {
+ finalPath = homePath->append(subFolder->d_name);
+ closedir(toSearchIn);
+ return finalPath;
+ }
+ }
+ } while (subFolder != NULL);
+
+ closedir(toSearchIn);
+ return NULL;
+}
+
+/**
+ * Initialise NSS
+ */
+void SignatureHandler::init_nss()
+{
+ GooString *certDBPath = getDefaultFirefoxCertDB_Linux();
+ if (certDBPath == NULL) {
+ NSS_Init("sql:/etc/pki/nssdb");
+ } else {
+ NSS_Init(certDBPath->getCString());
+ }
+ //Make sure NSS root certificates module is loaded
+ SECMOD_AddNewModule("Root Certs", "libnssckbi.so", 0, 0);
+
+ delete certDBPath;
+}
+
+
+SignatureHandler::SignatureHandler(unsigned char *p7, int p7_length)
+ : CMSMessage(NULL),
+ CMSSignedData(NULL),
+ CMSSignerInfo(NULL),
+ temp_certs(NULL)
+{
+ init_nss();
+ CMSitem.data = p7;
+ CMSitem.len = p7_length;
+ CMSMessage = CMS_MessageCreate(&CMSitem);
+ CMSSignedData = CMS_SignedDataCreate(CMSMessage);
+ CMSSignerInfo = CMS_SignerInfoCreate(CMSSignedData);
+ hash_context = initHashContext();
+}
+
+HASHContext * SignatureHandler::initHashContext()
+{
+
+ SECItem usedAlgorithm = NSS_CMSSignedData_GetDigestAlgs(CMSSignedData)[0]->algorithm;
+ hash_length = digestLength(SECOID_FindOIDTag(&usedAlgorithm));
+ HASH_HashType hashType;
+ hashType = HASH_GetHashTypeByOidTag(SECOID_FindOIDTag(&usedAlgorithm));
+ return HASH_Create(hashType);
+}
+
+void SignatureHandler::updateHash(unsigned char * data_block, int data_len)
+{
+ HASH_Update(hash_context, data_block, data_len);
+}
+
+SignatureHandler::~SignatureHandler()
+{
+ SECITEM_FreeItem(&CMSitem, PR_FALSE);
+ if (CMSSignerInfo)
+ NSS_CMSSignerInfo_Destroy(CMSSignerInfo);
+ if (CMSSignedData)
+ NSS_CMSSignedData_Destroy(CMSSignedData);
+ if (CMSMessage)
+ NSS_CMSMessage_Destroy(CMSMessage);
+
+ if (hash_context)
+ HASH_Destroy(hash_context);
+
+ free(temp_certs);
+
+ if (NSS_Shutdown()!=SECSuccess)
+ fprintf(stderr, "Detail: %s\n", PR_ErrorToString(PORT_GetError(), PR_LANGUAGE_I_DEFAULT));
+}
+
+NSSCMSMessage *SignatureHandler::CMS_MessageCreate(SECItem * cms_item)
+{
+ if (cms_item->data){
+ return NSS_CMSMessage_CreateFromDER(cms_item, NULL, NULL /* Content callback */
+ , NULL, NULL /*Password callback*/
+ , NULL, NULL /*Decrypt callback*/);
+ } else {
+ return NULL;
+ }
+}
+
+NSSCMSSignedData *SignatureHandler::CMS_SignedDataCreate(NSSCMSMessage * cms_msg)
+{
+ if (!NSS_CMSMessage_IsSigned(cms_msg)) {
+ error(errInternal, 0, "Input couldn't be parsed as a CMS signature");
+ return NULL;
+ }
+
+ NSSCMSContentInfo *cinfo = NSS_CMSMessage_ContentLevel(cms_msg, 0);
+ if (!cinfo) {
+ error(errInternal, 0, "Error in NSS_CMSMessage_ContentLevel");
+ return NULL;
+ }
+
+ NSSCMSSignedData *signedData = (NSSCMSSignedData*) NSS_CMSContentInfo_GetContent(cinfo);
+ if (!signedData) {
+ error(errInternal, 0, "CError in NSS_CMSContentInfo_GetContent()");
+ return NULL;
+ }
+
+ if (signedData->rawCerts)
+ {
+ size_t i;
+ for (i = 0; signedData->rawCerts[i]; ++i) {} // just count the length of the certificate chain
+
+ // tempCerts field needs to be filled for complete memory release by NSSCMSSignedData_Destroy
+ signedData->tempCerts = (CERTCertificate **) gmallocn( i+1, sizeof(CERTCertificate *));
+ memset(signedData->tempCerts, 0, (i+1) * sizeof(CERTCertificate *));
+ // store the adresses of these temporary certificates for future release
+ for (i = 0; signedData->rawCerts[i]; ++i)
+ signedData->tempCerts[i] = CERT_NewTempCertificate(CERT_GetDefaultCertDB(), signedData->rawCerts[i], NULL, 0, 0);
+
+ temp_certs = signedData->tempCerts;
+ return signedData;
+ } else {
+ return NULL;
+ }
+}
+
+NSSCMSSignerInfo *SignatureHandler::CMS_SignerInfoCreate(NSSCMSSignedData * cms_sig_data)
+{
+ NSSCMSSignerInfo *signerInfo = NSS_CMSSignedData_GetSignerInfo(cms_sig_data, 0);
+ if (!signerInfo) {
+ printf("Error in NSS_CMSSignedData_GetSignerInfo()\n");
+ return NULL;
+ } else {
+ return signerInfo;
+ }
+}
+
+NSSCMSVerificationStatus SignatureHandler::validateSignature()
+{
+ unsigned char *digest_buffer = NULL;
+
+ if (!CMSSignedData)
+ return NSSCMSVS_MalformedSignature;
+
+ digest_buffer = (unsigned char *)PORT_Alloc(hash_length);
+ unsigned int result_len = 0;
+
+ HASH_End(hash_context, digest_buffer, &result_len, hash_length);
+
+ SECItem digest;
+ digest.data = digest_buffer;
+ digest.len = hash_length;
+
+ if ((NSS_CMSSignerInfo_GetSigningCertificate(CMSSignerInfo, CERT_GetDefaultCertDB())) == NULL)
+ CMSSignerInfo->verificationStatus = NSSCMSVS_SigningCertNotFound;
+
+ SECItem * content_info_data = CMSSignedData->contentInfo.content.data;
+ if (content_info_data != NULL && content_info_data->data != NULL)
+ {
+ /*
+ This means it's not a detached type signature
+ so the digest is contained in SignedData->contentInfo
+ */
+ if (memcmp(digest.data, content_info_data->data, hash_length) == 0
+ && digest.len == content_info_data->len)
+ {
+ PORT_Free(digest_buffer);
+ return NSSCMSVS_GoodSignature;
+ }
+ else
+ {
+ PORT_Free(digest_buffer);
+ return NSSCMSVS_DigestMismatch;
+ }
+
+ }
+ else if (NSS_CMSSignerInfo_Verify(CMSSignerInfo, &digest, NULL) != SECSuccess)
+ {
+
+ PORT_Free(digest_buffer);
+ return CMSSignerInfo->verificationStatus;
+ }
+ else
+ {
+ PORT_Free(digest_buffer);
+ return NSSCMSVS_GoodSignature;
+ }
+}
+
+SECErrorCodes SignatureHandler::validateCertificate()
+{
+ SECErrorCodes retVal;
+ CERTCertificate *cert;
+
+ if (!CMSSignerInfo)
+ return (SECErrorCodes) -1; //error code to avoid matching error codes defined in SECErrorCodes
+
+ if ((cert = NSS_CMSSignerInfo_GetSigningCertificate(CMSSignerInfo, CERT_GetDefaultCertDB())) == NULL)
+ CMSSignerInfo->verificationStatus = NSSCMSVS_SigningCertNotFound;
+
+ CERTValInParam inParams[2];
+ inParams[0].type = cert_pi_revocationFlags;
+ inParams[0].value.pointer.revocation = CERT_GetClassicOCSPEnabledSoftFailurePolicy();
+ inParams[1].type = cert_pi_end;
+
+ CERT_PKIXVerifyCert(cert, certificateUsageEmailSigner, inParams, NULL,
+ CMSSignerInfo->cmsg->pwfn_arg);
+
+ retVal = (SECErrorCodes) PORT_GetError();
+
+ if (cert)
+ CERT_DestroyCertificate(cert);
+
+ return retVal;
+}
+
+
+SignatureValidationStatus SignatureHandler::NSS_SigTranslate(NSSCMSVerificationStatus nss_code)
+{
+ switch(nss_code)
+ {
+ case NSSCMSVS_GoodSignature:
+ return SIGNATURE_VALID;
+
+ case NSSCMSVS_BadSignature:
+ return SIGNATURE_INVALID;
+
+ case NSSCMSVS_DigestMismatch:
+ return SIGNATURE_DIGEST_MISMATCH;
+
+ case NSSCMSVS_ProcessingError:
+ return SIGNATURE_DECODING_ERROR;
+
+ default:
+ return SIGNATURE_GENERIC_ERROR;
+ }
+}
+
+CertificateValidationStatus SignatureHandler::NSS_CertTranslate(SECErrorCodes nss_code)
+{
+ // 0 not defined in SECErrorCodes, it means success for this purpose.
+ if (nss_code == (SECErrorCodes) 0)
+ return CERTIFICATE_TRUSTED;
+
+ switch(nss_code)
+ {
+ case SEC_ERROR_UNKNOWN_ISSUER:
+ return CERTIFICATE_UNKNOWN_ISSUER;
+
+ case SEC_ERROR_UNTRUSTED_ISSUER:
+ return CERTIFICATE_UNTRUSTED_ISSUER;
+
+ case SEC_ERROR_REVOKED_CERTIFICATE:
+ return CERTIFICATE_REVOKED;
+
+ case SEC_ERROR_EXPIRED_CERTIFICATE:
+ return CERTIFICATE_EXPIRED;
+
+ default:
+ return CERTIFICATE_GENERIC_ERROR;
+ }
+}
diff --git a/Build/source/libs/poppler/poppler-src/poppler/SignatureHandler.h b/Build/source/libs/poppler/poppler-src/poppler/SignatureHandler.h
new file mode 100644
index 00000000000..8e2a4daf968
--- /dev/null
+++ b/Build/source/libs/poppler/poppler-src/poppler/SignatureHandler.h
@@ -0,0 +1,70 @@
+//========================================================================
+//
+// SignatureHandler.h
+//
+// This file is licensed under the GPLv2 or later
+//
+// Copyright 2015 André Guerreiro <aguerreiro1985@gmail.com>
+// Copyright 2015 André Esser <bepandre@hotmail.com>
+// Copyright 2015 Albert Astals Cid <aacid@kde.org>
+//
+//========================================================================
+
+#ifndef SIGNATURE_HANDLER_H
+#define SIGNATURE_HANDLER_H
+
+#include "goo/GooString.h"
+#include "SignatureInfo.h"
+
+/* NSPR Headers */
+#include <nspr.h>
+
+/* NSS headers */
+#include <cms.h>
+#include <nss.h>
+#include <cert.h>
+#include <cryptohi.h>
+#include <secerr.h>
+#include <secoid.h>
+#include <secmodt.h>
+#include <sechash.h>
+
+class SignatureHandler
+{
+public:
+ SignatureHandler(unsigned char *p7, int p7_length);
+ ~SignatureHandler();
+ time_t getSigningTime();
+ char * getSignerName();
+ void setSignature(unsigned char *, int);
+ void updateHash(unsigned char * data_block, int data_len);
+ NSSCMSVerificationStatus validateSignature();
+ SECErrorCodes validateCertificate();
+
+ //Translate NSS error codes
+ static SignatureValidationStatus NSS_SigTranslate(NSSCMSVerificationStatus nss_code);
+ static CertificateValidationStatus NSS_CertTranslate(SECErrorCodes nss_code);
+
+private:
+ SignatureHandler(const SignatureHandler &);
+ SignatureHandler& operator=(const SignatureHandler &);
+
+ void init_nss();
+
+ GooString * getDefaultFirefoxCertDB_Linux();
+ unsigned int digestLength(SECOidTag digestAlgId);
+ NSSCMSMessage *CMS_MessageCreate(SECItem * cms_item);
+ NSSCMSSignedData *CMS_SignedDataCreate(NSSCMSMessage * cms_msg);
+ NSSCMSSignerInfo *CMS_SignerInfoCreate(NSSCMSSignedData * cms_sig_data);
+ HASHContext * initHashContext();
+
+ unsigned int hash_length;
+ SECItem CMSitem;
+ HASHContext *hash_context;
+ NSSCMSMessage *CMSMessage;
+ NSSCMSSignedData *CMSSignedData;
+ NSSCMSSignerInfo *CMSSignerInfo;
+ CERTCertificate **temp_certs;
+};
+
+#endif
diff --git a/Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.cc b/Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.cc
new file mode 100644
index 00000000000..8f7ec454df5
--- /dev/null
+++ b/Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.cc
@@ -0,0 +1,87 @@
+//========================================================================
+//
+// SignatureInfo.cc
+//
+// This file is licensed under the GPLv2 or later
+//
+// Copyright 2015 André Guerreiro <aguerreiro1985@gmail.com>
+// Copyright 2015 André Esser <bepandre@hotmail.com>
+//
+//========================================================================
+
+#include <config.h>
+
+#include "SignatureInfo.h"
+#include "goo/gmem.h"
+#include <stdlib.h>
+#include <string.h>
+
+/* Constructor & Destructor */
+
+SignatureInfo::SignatureInfo()
+{
+ sig_status = SIGNATURE_NOT_VERIFIED;
+ cert_status = CERTIFICATE_NOT_VERIFIED;
+ signer_name = NULL;
+ signing_time = 0;
+ sig_subfilter_supported = false;
+}
+
+SignatureInfo::SignatureInfo(SignatureValidationStatus sig_val_status, CertificateValidationStatus cert_val_status)
+{
+ sig_status = sig_val_status;
+ cert_status = cert_val_status;
+ signer_name = NULL;
+ signing_time = 0;
+ sig_subfilter_supported = false;
+}
+
+SignatureInfo::~SignatureInfo()
+{
+ free(signer_name);
+}
+
+/* GETTERS */
+
+SignatureValidationStatus SignatureInfo::getSignatureValStatus()
+{
+ return sig_status;
+}
+
+CertificateValidationStatus SignatureInfo::getCertificateValStatus()
+{
+ return cert_status;
+}
+
+char *SignatureInfo::getSignerName()
+{
+ return signer_name;
+}
+
+time_t SignatureInfo::getSigningTime()
+{
+ return signing_time;
+}
+
+/* SETTERS */
+
+void SignatureInfo::setSignatureValStatus(enum SignatureValidationStatus sig_val_status)
+{
+ sig_status = sig_val_status;
+}
+
+void SignatureInfo::setCertificateValStatus(enum CertificateValidationStatus cert_val_status)
+{
+ cert_status = cert_val_status;
+}
+
+void SignatureInfo::setSignerName(char *signerName)
+{
+ free(signer_name);
+ signer_name = signerName;
+}
+
+void SignatureInfo::setSigningTime(time_t signingTime)
+{
+ signing_time = signingTime;
+}
diff --git a/Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.h b/Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.h
new file mode 100644
index 00000000000..82b4ec4dd49
--- /dev/null
+++ b/Build/source/libs/poppler/poppler-src/poppler/SignatureInfo.h
@@ -0,0 +1,71 @@
+//========================================================================
+//
+// SignatureInfo.h
+//
+// This file is licensed under the GPLv2 or later
+//
+// Copyright 2015 André Guerreiro <aguerreiro1985@gmail.com>
+// Copyright 2015 André Esser <bepandre@hotmail.com>
+// Copyright 2015 Albert Astals Cid <aacid@kde.org>
+//
+//========================================================================
+
+#ifndef SIGNATUREINFO_H
+#define SIGNATUREINFO_H
+
+#include <time.h>
+
+enum SignatureValidationStatus
+{
+ SIGNATURE_VALID,
+ SIGNATURE_INVALID,
+ SIGNATURE_DIGEST_MISMATCH,
+ SIGNATURE_DECODING_ERROR,
+ SIGNATURE_GENERIC_ERROR,
+ SIGNATURE_NOT_FOUND,
+ SIGNATURE_NOT_VERIFIED
+};
+
+enum CertificateValidationStatus
+{
+ CERTIFICATE_TRUSTED,
+ CERTIFICATE_UNTRUSTED_ISSUER,
+ CERTIFICATE_UNKNOWN_ISSUER,
+ CERTIFICATE_REVOKED,
+ CERTIFICATE_EXPIRED,
+ CERTIFICATE_GENERIC_ERROR,
+ CERTIFICATE_NOT_VERIFIED
+};
+
+class SignatureInfo {
+public:
+ SignatureInfo();
+ SignatureInfo(SignatureValidationStatus, CertificateValidationStatus);
+ ~SignatureInfo();
+
+ /* GETTERS */
+ SignatureValidationStatus getSignatureValStatus();
+ CertificateValidationStatus getCertificateValStatus();
+ char *getSignerName();
+ time_t getSigningTime();
+ bool isSubfilterSupported() { return sig_subfilter_supported; }
+
+ /* SETTERS */
+ void setSignatureValStatus(enum SignatureValidationStatus );
+ void setCertificateValStatus(enum CertificateValidationStatus );
+ void setSignerName(char *);
+ void setSigningTime(time_t);
+ void setSubFilterSupport(bool isSupported) { sig_subfilter_supported = isSupported; }
+
+private:
+ SignatureInfo(const SignatureInfo &);
+ SignatureInfo& operator=(const SignatureInfo &);
+
+ SignatureValidationStatus sig_status;
+ CertificateValidationStatus cert_status;
+ char *signer_name;
+ time_t signing_time;
+ bool sig_subfilter_supported;
+};
+
+#endif
diff --git a/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc
index ac0f9ac19ff..13d090c601a 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc
+++ b/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc
@@ -22,7 +22,7 @@
// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com>
// Copyright (C) 2009-2016 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
-// Copyright (C) 2009, 2014, 2015 William Bader <williambader@hotmail.com>
+// Copyright (C) 2009, 2014-2016 William Bader <williambader@hotmail.com>
// Copyright (C) 2010 Patrick Spendrin <ps_ml@gmx.de>
// Copyright (C) 2010 Brian Cameron <brian.cameron@oracle.com>
// Copyright (C) 2010 Paweł Wiejacha <pawel.wiejacha@gmail.com>
@@ -240,6 +240,56 @@ void SplashGouraudPattern::getParameterizedColor(double colorinterp, SplashColor
}
//------------------------------------------------------------------------
+// SplashFunctionPattern
+//------------------------------------------------------------------------
+
+SplashFunctionPattern::SplashFunctionPattern(SplashColorMode colorModeA, GfxState *stateA, GfxFunctionShading *shadingA)
+{
+ Matrix ctm;
+ SplashColor defaultColor;
+ GfxColor srcColor;
+ double *matrix = shadingA->getMatrix();
+
+ shading = shadingA;
+ state = stateA;
+ colorMode = colorModeA;
+
+ state->getCTM(&ctm);
+
+ double a1 = ctm.m[0];
+ double b1 = ctm.m[1];
+ double c1 = ctm.m[2];
+ double d1 = ctm.m[3];
+
+ ctm.m[0] = matrix[0] * a1 + matrix[1] * c1;
+ ctm.m[1] = matrix[0] * b1 + matrix[1] * d1;
+ ctm.m[2] = matrix[2] * a1 + matrix[3] * c1;
+ ctm.m[3] = matrix[2] * b1 + matrix[3] * d1;
+ ctm.m[4] = matrix[4] * a1 + matrix[5] * c1 + ctm.m[4];
+ ctm.m[5] = matrix[4] * b1 + matrix[5] * d1 + ctm.m[5];
+ ctm.invertTo(&ictm);
+
+ gfxMode = shadingA->getColorSpace()->getMode();
+ shadingA->getColorSpace()->getDefaultColor(&srcColor);
+ shadingA->getDomain(&xMin, &yMin, &xMax, &yMax);
+ convertGfxColor(defaultColor, colorModeA, shadingA->getColorSpace(), &srcColor);
+}
+
+SplashFunctionPattern::~SplashFunctionPattern() {
+}
+
+GBool SplashFunctionPattern::getColor(int x, int y, SplashColorPtr c) {
+ GfxColor gfxColor;
+ double xc, yc;
+
+ ictm.transform(x, y, &xc, &yc);
+ if (xc < xMin || xc > xMax || yc < yMin || yc > yMax) return gFalse;
+ shading->getColor(xc, yc, &gfxColor);
+ convertGfxColor(c, colorMode, shading->getColorSpace(), &gfxColor);
+ return gTrue;
+}
+
+//------------------------------------------------------------------------
// SplashUnivariatePattern
//------------------------------------------------------------------------
@@ -1760,6 +1810,51 @@ SplashPattern *SplashOutputDev::getColor(GfxColor *deviceN) {
}
#endif
+void SplashOutputDev::getMatteColor(SplashColorMode colorMode, GfxImageColorMap *colorMap, GfxColor *matteColorIn, SplashColor matteColor) {
+ GfxGray gray;
+ GfxRGB rgb;
+#if SPLASH_CMYK
+ GfxCMYK cmyk;
+ GfxColor deviceN;
+#endif
+
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ colorMap->getColorSpace()->getGray(matteColorIn, &gray);
+ matteColor[0] = colToByte(gray);
+ break;
+ case splashModeRGB8:
+ case splashModeBGR8:
+ colorMap->getColorSpace()->getRGB(matteColorIn, &rgb);
+ matteColor[0] = colToByte(rgb.r);
+ matteColor[1] = colToByte(rgb.g);
+ matteColor[2] = colToByte(rgb.b);
+ break;
+ case splashModeXBGR8:
+ colorMap->getColorSpace()->getRGB(matteColorIn, &rgb);
+ matteColor[0] = colToByte(rgb.r);
+ matteColor[1] = colToByte(rgb.g);
+ matteColor[2] = colToByte(rgb.b);
+ matteColor[3] = 255;
+ break;
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+ colorMap->getColorSpace()->getCMYK(matteColorIn, &cmyk);
+ matteColor[0] = colToByte(cmyk.c);
+ matteColor[1] = colToByte(cmyk.m);
+ matteColor[2] = colToByte(cmyk.y);
+ matteColor[3] = colToByte(cmyk.k);
+ break;
+ case splashModeDeviceN8:
+ colorMap->getColorSpace()->getDeviceN(matteColorIn, &deviceN);
+ for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
+ matteColor[cp] = colToByte(deviceN.c[cp]);
+ break;
+#endif
+ }
+}
+
void SplashOutputDev::setOverprintMask(GfxColorSpace *colorSpace,
GBool overprintFlag,
int overprintMode,
@@ -2160,7 +2255,7 @@ reload:
// for substituted fonts: adjust the font matrix -- compare the
// width of 'm' in the original font and the substituted font
if (fontFile->doAdjustMatrix && !gfxFont->isCIDFont()) {
- double w1, w2;
+ double w1, w2, w3;
CharCode code;
char *name;
for (code = 0; code < 256; ++code) {
@@ -2172,7 +2267,8 @@ reload:
if (code < 256) {
w1 = ((Gfx8BitFont *)gfxFont)->getWidth(code);
w2 = font->getGlyphAdvance(code);
- if (!gfxFont->isSymbolic() && w2 > 0) {
+ w3 = ((Gfx8BitFont *)gfxFont)->getWidth(0);
+ if (!gfxFont->isSymbolic() && w2 > 0 && w1 > w3) {
// if real font is substantially narrower than substituted
// font, reduce the font size accordingly
if (w1 > 0.01 && w1 < 0.9 * w2) {
@@ -2350,6 +2446,9 @@ void SplashOutputDev::drawChar(GfxState *state, double x, double y,
doClip = render & 4;
path = NULL;
+ SplashCoord lineWidth = splash->getLineWidth();
+ if (doStroke && lineWidth == 0.0)
+ splash->setLineWidth(1 / state->getVDPI());
if (doStroke || doClip) {
if ((path = font->getGlyphPath(code))) {
path->offset((SplashCoord)x, (SplashCoord)y);
@@ -2394,6 +2493,7 @@ void SplashOutputDev::drawChar(GfxState *state, double x, double y,
splash->stroke(path);
}
}
+ splash->setLineWidth(lineWidth);
// clip
if (doClip) {
@@ -2898,6 +2998,9 @@ struct SplashOutImageData {
int *maskColors;
SplashColorMode colorMode;
int width, height, y;
+ ImageStream *maskStr;
+ GfxImageColorMap *maskColorMap;
+ SplashColor matteColor;
};
#ifdef USE_CMS
@@ -2931,6 +3034,11 @@ GBool SplashOutputDev::useIccImageSrc(void *data) {
}
#endif
+// Clip x to lie in [0, 255].
+static inline Guchar clip255(int x) {
+ return x < 0 ? 0 : x > 255 ? 255 : x;
+}
+
GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine,
Guchar * /*alphaLine*/) {
SplashOutImageData *imgData = (SplashOutImageData *)data;
@@ -3074,6 +3182,16 @@ GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine,
}
}
+ if (imgData->maskStr != NULL && (p = imgData->maskStr->getLine()) != NULL) {
+ int destComps = splashColorModeNComps[imgData->colorMode];
+ int convComps = (imgData->colorMode == splashModeXBGR8) ? 3 : destComps;
+ imgData->maskColorMap->getGrayLine(p, p, imgData->width);
+ for (x = 0, q = colorLine; x < imgData->width; ++x, p++, q += destComps) {
+ for (int cp = 0; cp < convComps; cp++) {
+ q[cp] = (*p) ? clip255(imgData->matteColor[cp] + (int) (q[cp] - imgData->matteColor[cp]) * 255 / *p) : imgData->matteColor[cp];
+ }
+ }
+ }
++imgData->y;
return gTrue;
}
@@ -3414,6 +3532,8 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
imgData.colorMode = colorMode;
imgData.width = width;
imgData.height = height;
+ imgData.maskStr = NULL;
+ imgData.maskColorMap = NULL;
imgData.y = 0;
// special case for one-channel (monochrome/gray/separation) images:
@@ -3878,6 +3998,8 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref,
imgMaskData.width = maskWidth;
imgMaskData.height = maskHeight;
imgMaskData.y = 0;
+ imgMaskData.maskStr = NULL;
+ imgMaskData.maskColorMap = NULL;
n = 1 << maskColorMap->getBits();
imgMaskData.lookup = (SplashColorPtr)gmalloc(n);
for (i = 0; i < n; ++i) {
@@ -3893,7 +4015,6 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref,
maskSplash->drawImage(&imageSrc, NULL, &imgMaskData, splashModeMono8, gFalse,
maskWidth, maskHeight, mat, maskInterpolate);
delete imgMaskData.imgStr;
- maskStr->close();
gfree(imgMaskData.lookup);
delete maskSplash;
splash->setSoftMask(maskBitmap);
@@ -3909,6 +4030,16 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref,
imgData.colorMode = colorMode;
imgData.width = width;
imgData.height = height;
+ imgData.maskStr = NULL;
+ imgData.maskColorMap = NULL;
+ if (maskColorMap->getMatteColor() != NULL) {
+ getMatteColor(colorMode, colorMap, maskColorMap->getMatteColor(), imgData.matteColor);
+ imgData.maskColorMap = maskColorMap;
+ imgData.maskStr = new ImageStream(maskStr, maskWidth,
+ maskColorMap->getNumPixelComps(),
+ maskColorMap->getBits());
+ imgData.maskStr->reset();
+ }
imgData.y = 0;
// special case for one-channel (monochrome/gray/separation) images:
@@ -3981,7 +4112,9 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref,
splash->drawImage(&imageSrc, NULL, &imgData, srcMode, gFalse, width, height, mat, interpolate);
splash->setSoftMask(NULL);
gfree(imgData.lookup);
+ delete imgData.maskStr;
delete imgData.imgStr;
+ maskStr->close();
str->close();
}
@@ -4515,7 +4648,7 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *ca
matc[2] = ctm[2];
matc[3] = ctm[3];
- if (surface_width == 0 || surface_height == 0) {
+ if (surface_width == 0 || surface_height == 0 || repeatX * repeatY <= 4) {
state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]);
return gFalse;
}
@@ -4698,6 +4831,73 @@ GBool SplashOutputDev::univariateShadedFill(GfxState *state, SplashUnivariatePat
return retVal;
}
+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);
+
+ GBool retVal = gFalse;
+ // get the clip region bbox
+ if (pattern->getShading()->getHasBBox()) {
+ pattern->getShading()->getBBox(&xMin, &yMin, &xMax, &yMax);
+ } else {
+ state->getClipBBox(&xMin, &yMin, &xMax, &yMax);
+
+ xMin = floor (xMin);
+ yMin = floor (yMin);
+ xMax = ceil (xMax);
+ yMax = ceil (yMax);
+
+ {
+ Matrix ctm, ictm;
+ double x[4], y[4];
+ int i;
+
+ state->getCTM(&ctm);
+ ctm.invertTo(&ictm);
+
+ ictm.transform(xMin, yMin, &x[0], &y[0]);
+ ictm.transform(xMax, yMin, &x[1], &y[1]);
+ ictm.transform(xMin, yMax, &x[2], &y[2]);
+ ictm.transform(xMax, yMax, &x[3], &y[3]);
+
+ xMin = xMax = x[0];
+ yMin = yMax = y[0];
+ for (i = 1; i < 4; i++) {
+ xMin = std::min<double>(xMin, x[i]);
+ yMin = std::min<double>(yMin, y[i]);
+ xMax = std::max<double>(xMax, x[i]);
+ yMax = std::max<double>(yMax, y[i]);
+ }
+ }
+ }
+
+ // fill the region
+ state->moveTo(xMin, yMin);
+ state->lineTo(xMax, yMin);
+ state->lineTo(xMax, yMax);
+ state->lineTo(xMin, yMax);
+ state->closePath();
+ path = convertPath(state, state->getPath(), gTrue);
+
+#if SPLASH_CMYK
+ pattern->getShading()->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS);
+#endif
+ setOverprintMask(pattern->getShading()->getColorSpace(), state->getFillOverprint(),
+ state->getOverprintMode(), NULL);
+ retVal = (splash->shadedFill(path, pattern->getShading()->getHasBBox(), pattern) == splashOk);
+ state->clearPath();
+ setVectorAntialias(vaa);
+ delete path;
+
+ delete pattern;
+
+ return retVal;
+}
+
GBool SplashOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) {
SplashAxialPattern *pattern = new SplashAxialPattern(colorMode, state, shading);
GBool retVal = univariateShadedFill(state, pattern, tMin, tMax);
diff --git a/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h b/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h
index ce4082f1d9c..e93a20f1821 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h
+++ b/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h
@@ -14,14 +14,14 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Takashi Iwai <tiwai@suse.de>
-// Copyright (C) 2009-2015 Thomas Freitag <Thomas.Freitag@alfa.de>
+// Copyright (C) 2009-2016 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com>
// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com>
// Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com>
// Copyright (C) 2011 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2012, 2015 Albert Astals Cid <aacid@kde.org>
-// Copyright (C) 2015 William Bader <williambader@hotmail.com>
+// Copyright (C) 2015, 2016 William Bader <williambader@hotmail.com>
//
// 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 +59,34 @@ struct SplashTransparencyGroup;
// Splash dynamic pattern
//------------------------------------------------------------------------
+class SplashFunctionPattern: public SplashPattern {
+public:
+
+ SplashFunctionPattern(SplashColorMode colorMode, GfxState *state, GfxFunctionShading *shading);
+
+ virtual SplashPattern *copy() { return new SplashFunctionPattern(colorMode, state, (GfxFunctionShading *) shading); }
+
+ virtual ~SplashFunctionPattern();
+
+ virtual GBool testPosition(int x, int y) { return gTrue; }
+
+ virtual GBool isStatic() { return gFalse; }
+
+ virtual GBool getColor(int x, int y, SplashColorPtr c);
+
+ virtual GfxFunctionShading *getShading() { return shading; }
+
+ virtual GBool isCMYK() { return gfxMode == csDeviceCMYK; }
+
+protected:
+ Matrix ictm;
+ double xMin, yMin, xMax, yMax;
+ GfxFunctionShading *shading;
+ GfxState *state;
+ SplashColorMode colorMode;
+ GfxColorSpaceMode gfxMode;
+};
+
class SplashUnivariatePattern: public SplashPattern {
public:
@@ -188,7 +216,7 @@ public:
// radialShadedFill()? If this returns false, these shaded fills
// will be reduced to a series of other drawing operations.
virtual GBool useShadedFills(int type)
- { return (type >= 2 && type <= 5) ? gTrue : gFalse; }
+ { return (type >= 1 && type <= 5) ? gTrue : gFalse; }
// Does this device use upside-down coordinates?
// (Upside-down means (0,0) is the top left corner of the page.)
@@ -250,6 +278,7 @@ public:
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep);
+ virtual GBool functionShadedFill(GfxState *state, GfxFunctionShading *shading);
virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax);
virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading, double tMin, double tMax);
virtual GBool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading);
@@ -379,6 +408,7 @@ private:
SplashPattern *getColor(GfxCMYK *cmyk);
SplashPattern *getColor(GfxColor *deviceN);
#endif
+ 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,
diff --git a/Build/source/libs/poppler/poppler-src/poppler/Stream.cc b/Build/source/libs/poppler/poppler-src/poppler/Stream.cc
index 961767896c2..1e6318e74fe 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/Stream.cc
+++ b/Build/source/libs/poppler/poppler-src/poppler/Stream.cc
@@ -22,7 +22,7 @@
// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com>
// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
// Copyright (C) 2010 Tomas Hoger <thoger@redhat.com>
-// Copyright (C) 2011, 2012 William Bader <williambader@hotmail.com>
+// Copyright (C) 2011, 2012, 2016 William Bader <williambader@hotmail.com>
// Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2012 Oliver Sander <sander@mi.fu-berlin.de>
// Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
@@ -70,7 +70,7 @@
#include "DCTStream.h"
#endif
-#ifdef ENABLE_ZLIB
+#ifdef ENABLE_ZLIB_UNCOMPRESS
#include "FlateStream.h"
#endif
@@ -3865,7 +3865,7 @@ GBool DCTStream::isBinary(GBool last) {
#endif
-#ifndef ENABLE_ZLIB
+#ifndef ENABLE_ZLIB_UNCOMPRESS
//------------------------------------------------------------------------
// FlateStream
//------------------------------------------------------------------------
@@ -5302,6 +5302,151 @@ GBool RunLengthEncoder::fillBuf() {
}
//------------------------------------------------------------------------
+// LZWEncoder
+//------------------------------------------------------------------------
+
+LZWEncoder::LZWEncoder(Stream *strA):
+ FilterStream(strA)
+{
+ inBufLen = 0;
+ outBufLen = 0;
+}
+
+LZWEncoder::~LZWEncoder() {
+ if (str->isEncoder()) {
+ delete str;
+ }
+}
+
+void LZWEncoder::reset() {
+ int i;
+
+ str->reset();
+
+ // initialize code table
+ for (i = 0; i < 256; ++i) {
+ table[i].byte = i;
+ table[i].next = NULL;
+ table[i].children = NULL;
+ }
+ nextSeq = 258;
+ codeLen = 9;
+
+ // initialize input buffer
+ inBufLen = str->doGetChars(sizeof(inBuf), inBuf);
+
+ // initialize output buffer with a clear-table code
+ outBuf = 256;
+ outBufLen = 9;
+ needEOD = gFalse;
+}
+
+int LZWEncoder::getChar() {
+ int ret;
+
+ if (inBufLen == 0 && !needEOD && outBufLen == 0) {
+ return EOF;
+ }
+ if (outBufLen < 8 && (inBufLen > 0 || needEOD)) {
+ fillBuf();
+ }
+ if (outBufLen >= 8) {
+ ret = (outBuf >> (outBufLen - 8)) & 0xff;
+ outBufLen -= 8;
+ } else {
+ ret = (outBuf << (8 - outBufLen)) & 0xff;
+ outBufLen = 0;
+ }
+ return ret;
+}
+
+int LZWEncoder::lookChar() {
+ if (inBufLen == 0 && !needEOD && outBufLen == 0) {
+ return EOF;
+ }
+ if (outBufLen < 8 && (inBufLen > 0 || needEOD)) {
+ fillBuf();
+ }
+ if (outBufLen >= 8) {
+ return (outBuf >> (outBufLen - 8)) & 0xff;
+ } else {
+ return (outBuf << (8 - outBufLen)) & 0xff;
+ }
+}
+
+// On input, outBufLen < 8.
+// This function generates, at most, 2 12-bit codes
+// --> outBufLen < 8 + 12 + 12 = 32
+void LZWEncoder::fillBuf() {
+ LZWEncoderNode *p0, *p1;
+ int seqLen, code, i;
+
+ if (needEOD) {
+ outBuf = (outBuf << codeLen) | 257;
+ outBufLen += codeLen;
+ needEOD = gFalse;
+ return;
+ }
+
+ // find longest matching sequence (if any)
+ p0 = table + inBuf[0];
+ seqLen = 1;
+ while (inBufLen > seqLen) {
+ for (p1 = p0->children; p1; p1 = p1->next) {
+ if (p1->byte == inBuf[seqLen]) {
+ break;
+ }
+ }
+ if (!p1) {
+ break;
+ }
+ p0 = p1;
+ ++seqLen;
+ }
+ code = (int)(p0 - table);
+
+ // generate an output code
+ outBuf = (outBuf << codeLen) | code;
+ outBufLen += codeLen;
+
+ // update the table
+ table[nextSeq].byte = seqLen < inBufLen ? inBuf[seqLen] : 0;
+ table[nextSeq].children = NULL;
+ if (table[code].children) {
+ table[nextSeq].next = table[code].children;
+ } else {
+ table[nextSeq].next = NULL;
+ }
+ table[code].children = table + nextSeq;
+ ++nextSeq;
+
+ // update the input buffer
+ memmove(inBuf, inBuf + seqLen, inBufLen - seqLen);
+ inBufLen -= seqLen;
+ inBufLen += str->doGetChars(sizeof(inBuf) - inBufLen, inBuf + inBufLen);
+
+ // increment codeLen; generate clear-table code
+ if (nextSeq == (1 << codeLen)) {
+ ++codeLen;
+ if (codeLen == 13) {
+ outBuf = (outBuf << 12) | 256;
+ outBufLen += 12;
+ for (i = 0; i < 256; ++i) {
+ table[i].next = NULL;
+ table[i].children = NULL;
+ }
+ nextSeq = 258;
+ codeLen = 9;
+ }
+ }
+
+ // generate EOD next time
+ if (inBufLen == 0) {
+ needEOD = gTrue;
+ }
+}
+
+//------------------------------------------------------------------------
// CMYKGrayEncoder
//------------------------------------------------------------------------
diff --git a/Build/source/libs/poppler/poppler-src/poppler/Stream.h b/Build/source/libs/poppler/poppler-src/poppler/Stream.h
index 00b2925b3d5..8304b6cc51c 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/Stream.h
+++ b/Build/source/libs/poppler/poppler-src/poppler/Stream.h
@@ -19,7 +19,7 @@
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com>
// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
-// Copyright (C) 2011, 2012 William Bader <williambader@hotmail.com>
+// Copyright (C) 2011, 2012, 2016 William Bader <williambader@hotmail.com>
// Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it>
// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com>
@@ -942,7 +942,7 @@ private:
#endif
-#ifndef ENABLE_ZLIB
+#ifndef ENABLE_ZLIB_UNCOMPRESS
//------------------------------------------------------------------------
// FlateStream
//------------------------------------------------------------------------
@@ -1198,6 +1198,44 @@ private:
};
//------------------------------------------------------------------------
+// LZWEncoder
+//------------------------------------------------------------------------
+
+struct LZWEncoderNode {
+ int byte;
+ LZWEncoderNode *next; // next sibling
+ LZWEncoderNode *children; // first child
+};
+
+class LZWEncoder: public FilterStream {
+public:
+
+ LZWEncoder(Stream *strA);
+ virtual ~LZWEncoder();
+ virtual StreamKind getKind() { return strWeird; }
+ virtual void reset();
+ virtual int getChar();
+ virtual int lookChar();
+ virtual GooString *getPSFilter(int psLevel, const char *indent)
+ { return NULL; }
+ virtual GBool isBinary(GBool last = gTrue) { return gTrue; }
+ virtual GBool isEncoder() { return gTrue; }
+
+private:
+
+ LZWEncoderNode table[4096];
+ int nextSeq;
+ int codeLen;
+ Guchar inBuf[4096];
+ int inBufLen;
+ int outBuf;
+ int outBufLen;
+ GBool needEOD;
+
+ void fillBuf();
+};
+
+//------------------------------------------------------------------------
// CMYKGrayEncoder
//------------------------------------------------------------------------
diff --git a/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc
index fff3f05e830..afd89597f2b 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc
+++ b/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc
@@ -30,7 +30,7 @@
// Copyright (C) 2010 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
// Copyright (C) 2011 Sam Liao <phyomh@gmail.com>
// Copyright (C) 2012 Horst Prote <prote@fmi.uni-stuttgart.de>
-// Copyright (C) 2012, 2013-2015 Jason Crain <jason@aquaticape.us>
+// Copyright (C) 2012, 2013-2016 Jason Crain <jason@aquaticape.us>
// Copyright (C) 2012 Peter Breitenlohner <peb@mppmu.mpg.de>
// Copyright (C) 2013 José Aliste <jaliste@src.gnome.org>
// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
@@ -54,6 +54,7 @@
#include <math.h>
#include <float.h>
#include <ctype.h>
+#include <algorithm>
#ifdef _WIN32
#include <fcntl.h> // for O_BINARY
#include <io.h> // for setmode
@@ -2064,7 +2065,8 @@ GBool TextBlock::isBeforeByRule2(TextBlock *blk1) {
// http://en.wikipedia.org/wiki/Topological_sorting
int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1,
TextBlock **sorted, int sortPos,
- GBool* visited) {
+ GBool* visited,
+ TextBlock **cache, int cacheSize) {
int pos2;
TextBlock *blk1, *blk2, *blk3;
GBool before;
@@ -2119,15 +2121,29 @@ int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1,
// such that blk1 is before blk3 by rule 1,
// and blk3 is before blk2 by rule 1.
before = gTrue;
- for (blk3 = blkList; blk3; blk3 = blk3->next) {
- if (blk3 == blk2 || blk3 == blk1) {
- continue;
- }
- if (blk1->isBeforeByRule1(blk3) &&
- blk3->isBeforeByRule1(blk2)) {
+ for (int i = 0; i < cacheSize && cache[i]; ++i) {
+ if (blk1->isBeforeByRule1(cache[i]) &&
+ cache[i]->isBeforeByRule1(blk2)) {
before = gFalse;
+ std::rotate(cache, cache + i, cache + i + 1);
break;
}
+ }
+
+ if (before) {
+ for (blk3 = blkList; blk3; blk3 = blk3->next) {
+ if (blk3 == blk2 || blk3 == blk1) {
+ continue;
+ }
+ if (blk1->isBeforeByRule1(blk3) &&
+ blk3->isBeforeByRule1(blk2)) {
+ before = gFalse;
+ std::copy_backward(cache, cache + cacheSize - 1,
+ cache + cacheSize);
+ cache[0] = blk3;
+ break;
+ }
+ }
}
#if 0 // for debugging
if (before) {
@@ -2141,7 +2157,7 @@ int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1,
if (before) {
// blk2 is before blk1, so it needs to be visited
// before we can add blk1 to the sorted list.
- sortPos = blk2->visitDepthFirst(blkList, pos2, sorted, sortPos, visited);
+ sortPos = blk2->visitDepthFirst(blkList, pos2, sorted, sortPos, visited, cache, cacheSize);
}
}
#if 0 // for debugging
@@ -2152,6 +2168,16 @@ int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1,
return sortPos;
}
+int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1,
+ TextBlock **sorted, int sortPos,
+ GBool* visited) {
+ const int blockCacheSize = 4;
+ TextBlock *blockCache[blockCacheSize];
+ std::fill(blockCache, blockCache + blockCacheSize, (TextBlock*)NULL);
+ return visitDepthFirst(blkList, pos1, sorted, sortPos, visited, blockCache,
+ blockCacheSize);
+}
+
//------------------------------------------------------------------------
// TextFlow
//------------------------------------------------------------------------
diff --git a/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.h b/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.h
index 2aab94f5d15..7da797c296f 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.h
+++ b/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.h
@@ -19,7 +19,7 @@
// Copyright (C) 2007 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2008, 2010, 2015 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2010 Brian Ewins <brian.ewins@gmail.com>
-// Copyright (C) 2012, 2013, 2015 Jason Crain <jason@aquaticape.us>
+// Copyright (C) 2012, 2013, 2015, 2016 Jason Crain <jason@aquaticape.us>
// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
//
// To see a description of the changes please see the Changelog file that
@@ -396,6 +396,10 @@ private:
int visitDepthFirst(TextBlock *blkList, int pos1,
TextBlock **sorted, int sortPos,
GBool* visited);
+ int visitDepthFirst(TextBlock *blkList, int pos1,
+ TextBlock **sorted, int sortPos,
+ GBool* visited,
+ TextBlock **cache, int cacheSize);
TextPage *page; // the parent page
int rot; // text rotation
diff --git a/Build/source/libs/poppler/poppler-src/poppler/XRef.cc b/Build/source/libs/poppler/poppler-src/poppler/XRef.cc
index 1bbbdc51c25..76ffc6ff95b 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/XRef.cc
+++ b/Build/source/libs/poppler/poppler-src/poppler/XRef.cc
@@ -20,7 +20,7 @@
// Copyright (C) 2007 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2009, 2010 Ilya Gorenbein <igorenbein@finjan.com>
// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
-// Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@kabelmail.de>
+// Copyright (C) 2012, 2013, 2016 Thomas Freitag <Thomas.Freitag@kabelmail.de>
// Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it>
// Copyright (C) 2013, 2014 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2013 Pino Toscano <pino@kde.org>
@@ -297,6 +297,7 @@ void XRef::init() {
ownerPasswordOk = gFalse;
rootNum = -1;
strOwner = gFalse;
+ xrefReconstructed = gFalse;
}
XRef::XRef() {
@@ -1249,6 +1250,11 @@ Object *XRef::fetch(int num, int gen, Object *obj, int recursion) {
return obj;
err:
+ if (!xRefStream && !xrefReconstructed) {
+ rootNum = -1;
+ constructXRef(&xrefReconstructed);
+ return fetch(num, gen, obj, ++recursion);
+ }
return obj->initNull();
}
diff --git a/Build/source/libs/poppler/poppler-src/poppler/XRef.h b/Build/source/libs/poppler/poppler-src/poppler/XRef.h
index 70065d8963e..8748cb49906 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/XRef.h
+++ b/Build/source/libs/poppler/poppler-src/poppler/XRef.h
@@ -19,7 +19,7 @@
// Copyright (C) 2007 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2010 Ilya Gorenbein <igorenbein@finjan.com>
// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
-// Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@kabelmail.de>
+// Copyright (C) 2012, 2013, 2016 Thomas Freitag <Thomas.Freitag@kabelmail.de>
// Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it>
// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com>
//
@@ -201,6 +201,7 @@ private:
int rootNum, rootGen; // catalog dict
GBool ok; // true if xref table is valid
int errCode; // error code (if <ok> is false)
+ GBool xrefReconstructed; // marker, true if xref was already reconstructed
Object trailerDict; // trailer dictionary
Goffset *streamEnds; // 'endstream' positions - only used in
// damaged files
diff --git a/Build/source/libs/poppler/poppler-src/poppler/poppler-config.h.in b/Build/source/libs/poppler/poppler-src/poppler/poppler-config.h.in
index cb77eb7674d..79d452f4d1e 100644
--- a/Build/source/libs/poppler/poppler-src/poppler/poppler-config.h.in
+++ b/Build/source/libs/poppler/poppler-src/poppler/poppler-config.h.in
@@ -81,9 +81,9 @@
#undef ENABLE_LIBPNG
#endif
-/* Use zlib instead of builtin zlib decoder. */
-#ifndef ENABLE_ZLIB
-#undef ENABLE_ZLIB
+/* Use zlib instead of builtin zlib decoder for uncompressing flate streams. */
+#ifndef ENABLE_ZLIB_UNCOMPRESS
+#undef ENABLE_ZLIB_UNCOMPRESS
#endif
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
diff --git a/Build/source/libs/poppler/version.ac b/Build/source/libs/poppler/version.ac
index 9325e1f995a..934ec8f7ec1 100644
--- a/Build/source/libs/poppler/version.ac
+++ b/Build/source/libs/poppler/version.ac
@@ -8,4 +8,4 @@ dnl
dnl --------------------------------------------------------
dnl
dnl m4-include this file to define the current poppler version
-m4_define([poppler_version], [0.41.0])
+m4_define([poppler_version], [0.42.0])