[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3-desktop' - 12 commits - download.lst embeddedobj/source external/nss include/vcl oox/source sal/textenc sc/source sw/source vcl/source vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Aug 8 11:08:11 UTC 2018


 download.lst                                  |    4 
 embeddedobj/source/msole/oleembed.cxx         |    2 
 external/nss/ExternalProject_nss.mk           |   71 ++++-----------
 external/nss/Module_nss.mk                    |    2 
 external/nss/UnpackedTarball_nss.mk           |   12 --
 external/nss/asan.patch.1                     |    8 -
 external/nss/clang-cl.patch.0                 |   37 ++++++++
 external/nss/nss.patch                        |  116 +++++++++++---------------
 external/nss/nss.vs2015.patch                 |   10 ++
 include/vcl/filter/pdfdocument.hxx            |   12 ++
 include/vcl/ppdparser.hxx                     |    2 
 oox/source/drawingml/chart/chartconverter.cxx |   40 +++-----
 sal/textenc/tcvtkr6.tab                       |    2 
 sc/source/filter/rtf/eeimpars.cxx             |    2 
 sw/source/core/unocore/unoportenum.cxx        |   28 +++---
 sw/source/filter/ww8/ww8par.cxx               |    1 
 sw/source/filter/ww8/ww8par.hxx               |    2 
 sw/source/filter/ww8/ww8par5.cxx              |    9 --
 vcl/source/filter/ipdf/pdfdocument.cxx        |   28 +++++-
 vcl/source/gdi/CommonSalLayout.cxx            |    9 +-
 vcl/unx/generic/printer/jobdata.cxx           |    3 
 vcl/unx/generic/printer/ppdparser.cxx         |   12 +-
 22 files changed, 221 insertions(+), 191 deletions(-)

New commits:
commit 906a406fb3df739fa3592879a75a49d3d417c41e
Author:     Andras Timar <andras.timar at collabora.com>
AuthorDate: Wed Aug 8 13:00:11 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Aug 8 13:07:43 2018 +0200

    nss: upgrade to release 3.38
    
    Fixes CVE-2018-0495 and "the ASN.1 code".
    
    Change-Id: I96ec90aaee7e4a803ebde1508951c55db4577e9e
    (cherry picked from commit b01ee1682286a52cda1ee14597257e1f862d4e16)

diff --git a/download.lst b/download.lst
index 633841df48a2..dd646e72cf54 100644
--- a/download.lst
+++ b/download.lst
@@ -115,8 +115,8 @@ export MWAW_TARBALL := libmwaw-0.3.$(MWAW_VERSION_MICRO).tar.bz2
 export MYSQLCPPCONN_TARBALL := 7239a4430efd4d0189c4f24df67f08e5-mysql-connector-c++-1.1.4.tar.gz
 export MYTHES_TARBALL := a8c2c5b8f09e7ede322d5c602ff6a4b6-mythes-1.2.4.tar.gz
 export NEON_TARBALL := 231adebe5c2f78fded3e3df6e958878e-neon-0.30.1.tar.gz
-export NSS_MD5SUM := e55ee06b22687df68fafc6a30c0554b2
-export NSS_TARBALL := nss-3.29.5-with-nspr-4.13.1.tar.gz
+export NSS_MD5SUM := cd649be8ee61fe15d64d7bef361b37ba
+export NSS_TARBALL := nss-3.38-with-nspr-4.19.tar.gz
 export ODFGEN_MD5SUM := 32572ea48d9021bbd6fa317ddb697abc
 export ODFGEN_VERSION_MICRO := 6
 export ODFGEN_TARBALL := libodfgen-0.1.$(ODFGEN_VERSION_MICRO).tar.bz2
diff --git a/external/nss/ExternalProject_nss.mk b/external/nss/ExternalProject_nss.mk
index b7bdf4b26ac9..8ce10b0a4ee9 100644
--- a/external/nss/ExternalProject_nss.mk
+++ b/external/nss/ExternalProject_nss.mk
@@ -9,25 +9,14 @@
 
 $(eval $(call gb_ExternalProject_ExternalProject,nss))
 
+# nss build calls configure for nspr itself - if for some reason the configure step should be split out,
+# make sure to create config.status (aka run configure) in dir specified with OBJDIR_NAME (nspr/out)
 $(eval $(call gb_ExternalProject_register_targets,nss,\
-	configure \
 	build \
 ))
 
-$(call gb_ExternalProject_get_state_target,nss,configure):
-	$(call gb_ExternalProject_run,configure,\
-		$(if $(filter MSC,$(COM)),INCLUDE="$(COMPATH)/include" LIB="$(ILIB)") \
-		$(if $(CROSS_COMPILING),\
-			NSINSTALL="$(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/external/nss/nsinstall.py") \
-		nspr/configure --includedir=$(call gb_UnpackedTarball_get_dir,nss)/mozilla/dist/out/include \
-			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
-			$(if $(filter MSC-X86_64,$(COM)-$(CPUNAME)),--enable-64bit) \
-			$(if $(filter MSC-INTEL,$(COM)-$(CPUNAME)),--host=i686-pc-cygwin) \
-	,,nss_configure.log)
-
 ifeq ($(OS),WNT)
-ifeq ($(COM),MSC)
-$(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject_get_state_target,nss,configure) $(call gb_ExternalExecutable_get_dependencies,python)
+$(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalExecutable_get_dependencies,python)
 	$(call gb_ExternalProject_run,build,\
 		$(if $(MSVC_USE_DEBUG_RUNTIME),USE_DEBUG_RTL=1,BUILD_OPT=1) \
 		MOZ_MSVCVERSION=9 OS_TARGET=WIN95 \
@@ -38,28 +27,10 @@ $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject
 			NSINSTALL='$(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/external/nss/nsinstall.py' \
 	,nss)
 
-
-else
-$(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject_get_state_target,nss,configure) $(call gb_ExternalExecutable_get_dependencies,python)
-	$(call gb_ExternalProject_run,build,\
-		$(MAKE) -j1 nss_build_all \
-			NS_USE_GCC=1 \
-			CC="$(CC) $(if $(MINGW_SHARED_GCCLIB),-shared-libgcc)" \
-			CXX="$(CXX) $(if $(MINGW_SHARED_GCCLIB),-shared-libgcc)" \
-			OS_LIBS="-ladvapi32 -lws2_32 -lmswsock -lwinmm $(if $(MINGW_SHARED_GXXLIB),$(MINGW_SHARED_LIBSTDCPP))" \
-			LDFLAGS="" \
-			PATH="$(PATH)" \
-			RANLIB="$(RANLIB)" \
-			OS_TARGET=WINNT RC="$(WINDRES)" OS_RELEASE="5.0" \
-			IMPORT_LIB_SUFFIX=dll.a \
-			NSPR_CONFIGURE_OPTS="--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) --enable-shared --disable-static" \
-			NSINSTALL="$(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/external/nss/nsinstall.py" \
-		&& rm -f $(call gb_UnpackedTarball_get_dir,nss)/mozilla/dist/out/lib/*.a \
-	,nss)
-
-endif
 else # OS!=WNT
-$(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject_get_state_target,nss,configure) $(call gb_ExternalExecutable_get_dependencies,python)
+# make sure to specify NSPR_CONFIGURE_OPTS as env (before make command), so nss can append it's own defaults
+# OTOH specify e.g. CC and NSINSTALL as arguments (after make command), so they will overrule nss makefile values
+$(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalExecutable_get_dependencies,python)
 	$(call gb_ExternalProject_run,build,\
 		$(if $(filter FREEBSD LINUX MACOSX,$(OS)),$(if $(filter X86_64,$(CPUNAME)),USE_64=1)) \
 		$(if $(filter IOS,$(OS)),\
@@ -72,30 +43,32 @@ $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject
 		$(if $(CROSS_COMPILING),\
 			$(if $(filter MACOSXPOWERPC,$(OS)$(CPUNAME)),CPU_ARCH=ppc) \
 			$(if $(filter IOS-ARM,$(OS)-$(CPUNAME)),CPU_ARCH=arm) \
-			NSINSTALL="$(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/external/nss/nsinstall.py") \
+			NSPR_CONFIGURE_OPTS="--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)") \
 		NSDISTMODE=copy \
 		$(MAKE) -j1 AR="$(AR)" \
 			RANLIB="$(RANLIB)" \
 			NMEDIT="$(NM)edit" \
-			CCC="$(CXX)" \
-			$(if $(CROSS_COMPILING),NSPR_CONFIGURE_OPTS="--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)") \
+			COMMA=$(COMMA) \
+			CC="$(CC)" CCC="$(CXX)" \
+			$(if $(CROSS_COMPILING),NSINSTALL="$(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/external/nss/nsinstall.py") \
+			$(if $(filter ANDROID,$(OS)),OS_TARGET=Android OS_TARGET_RELEASE=14 ARCHFLAG="" DEFAULT_COMPILER=clang ANDROID_NDK=$(ANDROID_NDK_HOME) ANDROID_TOOLCHAIN_VERSION=$(ANDROID_GCC_TOOLCHAIN_VERSION)) \
 			nss_build_all \
 		&& rm -f $(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib/*.a \
 		$(if $(filter MACOSX,$(OS)),\
 			&& chmod u+w $(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib/*.dylib \
 			&& $(PERL) \
 				$(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl OOO \
-				$(gb_Package_SOURCEDIR_nss)/dist/out/lib/libfreebl3.dylib \
-				$(gb_Package_SOURCEDIR_nss)/dist/out/lib/libnspr4.dylib \
-				$(gb_Package_SOURCEDIR_nss)/dist/out/lib/libnss3.dylib \
-				$(gb_Package_SOURCEDIR_nss)/dist/out/lib/libnssckbi.dylib \
-				$(gb_Package_SOURCEDIR_nss)/dist/out/lib/libnssdbm3.dylib \
-				$(gb_Package_SOURCEDIR_nss)/dist/out/lib/libnssutil3.dylib \
-				$(gb_Package_SOURCEDIR_nss)/dist/out/lib/libplc4.dylib \
-				$(gb_Package_SOURCEDIR_nss)/dist/out/lib/libplds4.dylib \
-				$(gb_Package_SOURCEDIR_nss)/dist/out/lib/libsmime3.dylib \
-				$(gb_Package_SOURCEDIR_nss)/dist/out/lib/libsoftokn3.dylib \
-				$(gb_Package_SOURCEDIR_nss)/dist/out/lib/libssl3.dylib) \
+				$(EXTERNAL_WORKDIR)/dist/out/lib/libfreebl3.dylib \
+				$(EXTERNAL_WORKDIR)/dist/out/lib/libnspr4.dylib \
+				$(EXTERNAL_WORKDIR)/dist/out/lib/libnss3.dylib \
+				$(EXTERNAL_WORKDIR)/dist/out/lib/libnssckbi.dylib \
+				$(EXTERNAL_WORKDIR)/dist/out/lib/libnssdbm3.dylib \
+				$(EXTERNAL_WORKDIR)/dist/out/lib/libnssutil3.dylib \
+				$(EXTERNAL_WORKDIR)/dist/out/lib/libplc4.dylib \
+				$(EXTERNAL_WORKDIR)/dist/out/lib/libplds4.dylib \
+				$(EXTERNAL_WORKDIR)/dist/out/lib/libsmime3.dylib \
+				$(EXTERNAL_WORKDIR)/dist/out/lib/libsoftokn3.dylib \
+				$(EXTERNAL_WORKDIR)/dist/out/lib/libssl3.dylib) \
 	,nss)
 
 endif
diff --git a/external/nss/Module_nss.mk b/external/nss/Module_nss.mk
index 69b39f59ee5d..eae9e9524480 100644
--- a/external/nss/Module_nss.mk
+++ b/external/nss/Module_nss.mk
@@ -9,12 +9,10 @@
 
 $(eval $(call gb_Module_Module,nss))
 
-ifeq ($(filter ANDROID,$(OS)),)
 $(eval $(call gb_Module_add_targets,nss,\
 	UnpackedTarball_nss \
 	ExternalPackage_nss \
 	ExternalProject_nss \
 ))
-endif
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/nss/UnpackedTarball_nss.mk b/external/nss/UnpackedTarball_nss.mk
index 4a90853f543a..314ff875ecbd 100644
--- a/external/nss/UnpackedTarball_nss.mk
+++ b/external/nss/UnpackedTarball_nss.mk
@@ -17,26 +17,20 @@ $(eval $(call gb_UnpackedTarball_add_patches,nss,\
 	external/nss/nss-3.13.5-zlib-werror.patch \
 	external/nss/nss_macosx.patch \
 	external/nss/nss-win32-make.patch.1 \
-	$(if $(filter WNTMSC,$(OS)$(COM)),external/nss/nss.windows.patch \
+	$(if $(filter WNT,$(OS)),external/nss/nss.windows.patch \
         external/nss/nss.nowerror.patch \
 		external/nss/nss.vs2015.patch) \
-	$(if $(filter WNTGCC,$(OS)$(COM)),external/nss/nspr-4.9-build.patch.3 \
-		external/nss/nss-3.13.3-build.patch.3 \
-		external/nss/nss.mingw.patch.3) \
     external/nss/ubsan.patch.0 \
     external/nss/clang-cl.patch.0 \
-    external/nss/nss.windowbuild.patch.0 \
     $(if $(filter IOS,$(OS)), \
         external/nss/nss-chromium-nss-static.patch \
         external/nss/nss-more-static.patch \
         external/nss/nss-ios.patch) \
 	$(if $(filter MSC-INTEL,$(COM)-$(CPUNAME)), \
 		external/nss/nss.cygwin64.in32bit.patch) \
-	$(if $(filter WNTMSC,$(OS)$(COM)), \
+	$(if $(filter WNT,$(OS)), \
 		external/nss/nss.vs2015.pdb.patch) \
-    $(if $(findstring 120_70,$(VCVER)_$(WINDOWS_SDK_VERSION)), \
-        external/nss/nss-winXP-sdk.patch.1) \
-	$(if $(filter WNTMSC,$(OS)$(COM)), \
+	$(if $(filter WNT,$(OS)), \
     	external/nss/nss.utf8bom.patch.1) \
 ))
 
diff --git a/external/nss/asan.patch.1 b/external/nss/asan.patch.1
index 0685adb1dc4b..7dfd6ed4e782 100644
--- a/external/nss/asan.patch.1
+++ b/external/nss/asan.patch.1
@@ -1,12 +1,12 @@
 diff -ur nss.org/nss/coreconf/Linux.mk nss/nss/coreconf/Linux.mk
 --- nss.org/nss/coreconf/Linux.mk	2014-05-06 04:36:01.817838877 +0200
 +++ nss/nss/coreconf/Linux.mk	2014-05-06 04:37:25.387835456 +0200
-@@ -158,7 +158,7 @@
+@@ -146,7 +146,7 @@
  # we don't use -z defs there.
  # Also, -z defs conflicts with Address Sanitizer, which emits relocations
  # against the libsanitizer runtime built into the main executable.
 -ZDEFS_FLAG		= -Wl,-z,defs
 +ZDEFS_FLAG		=
- ifneq ($(USE_ASAN),1)
- DSO_LDOPTS             += $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG)) -Wl,-z,origin '-Wl,-rpath,$$ORIGIN'
- endif
+ DSO_LDOPTS		+= $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG)) $(if $(filter-out $(OS),ANDROID),-Wl$(COMMA)-z$(COMMA)origin '-Wl$(COMMA)-rpath$(COMMA)$$ORIGIN')
+ LDFLAGS			+= $(ARCHFLAG) -z noexecstack
+ 
diff --git a/external/nss/clang-cl.patch.0 b/external/nss/clang-cl.patch.0
index 98786d49971c..684cf74d3ca6 100644
--- a/external/nss/clang-cl.patch.0
+++ b/external/nss/clang-cl.patch.0
@@ -72,3 +72,40 @@
  /* This magic gets the windows compiler to give us a deprecation
   * warning */
  #pragma deprecated(CKT_NSS_UNTRUSTED, CKT_NSS_MUST_VERIFY, CKT_NSS_VALID)
+
+# While MSVC uses
+#  #pragma warning(disable : 4103)
+# in the inner pkcs11p.h, clang-cl wants
+#  #pragma clang diagnostic ignored "-Wpragma-pack"
+# in the outer pkcs11t.h:
+--- nss/lib/util/pkcs11t.h
++++ nss/lib/util/pkcs11t.h
+@@ -72,7 +72,14 @@
+ #define CK_INVALID_HANDLE 0
+ 
+ /* pack */
++#if defined __clang__ && defined _MSC_VER
++#pragma clang diagnostic push
++#pragma clang diagnostic ignored "-Wpragma-pack"
++#endif
+ #include "pkcs11p.h"
++#if defined __clang__ && defined _MSC_VER
++#pragma clang diagnostic pop
++#endif
+ 
+ typedef struct CK_VERSION {
+     CK_BYTE major; /* integer portion of version number */
+@@ -1795,6 +1802,13 @@
+ #include "pkcs11n.h"
+ 
+ /* undo packing */
++#if defined __clang__ && defined _MSC_VER
++#pragma clang diagnostic push
++#pragma clang diagnostic ignored "-Wpragma-pack"
++#endif
+ #include "pkcs11u.h"
++#if defined __clang__ && defined _MSC_VER
++#pragma clang diagnostic pop
++#endif
+ 
+ #endif
diff --git a/external/nss/nss.patch b/external/nss/nss.patch
index b3b932343d83..6219775c2d3c 100644
--- a/external/nss/nss.patch
+++ b/external/nss/nss.patch
@@ -1,5 +1,16 @@
---- a/nss.orig/nspr/pr/src/misc/prnetdb.c	2016-02-12 14:51:25.000000000 +0100
-+++ b/nss/nspr/pr/src/misc/prnetdb.c	2016-03-04 19:23:00.462892600 +0100
+--- a/a/nspr/configure	2017-08-29 23:44:13.686045013 +0530
++++ b/b/nspr/configure	2017-08-29 23:46:53.774768655 +0530
+@@ -7034,7 +7034,7 @@
+     PR_MD_CSRCS=linux.c
+     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+     DSO_CFLAGS=-fPIC
+-    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
++    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@) $(if $(filter-out $(OS),ANDROID),-Wl$(COMMA)-z$(COMMA)origin -Wl$(COMMA)-rpath$(COMMA)\$$ORIGIN)'
+     _OPTIMIZE_FLAGS=-O2
+     _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
+                                    # combo is not yet good at debugging inlined
+--- a/nss.orig/nspr/pr/src/misc/prnetdb.c	2017-08-29 23:44:13.690045031 +0530
++++ b/nss/nspr/pr/src/misc/prnetdb.c	2017-08-29 23:47:03.810814019 +0530
 @@ -438,7 +438,7 @@
  	char *buf = *bufp;
  	PRIntn buflen = *buflenp;
@@ -9,21 +20,8 @@
  		PRIntn skip = align - ((ptrdiff_t)buf & (align - 1));
  		if (buflen < skip) {
  			return 0;
-diff -ru a/nspr/configure b/nspr/configure
---- a/a/nspr/configure	2014-09-29 16:46:38.427423757 +0100
-+++ b/b/nspr/configure	2014-09-29 16:47:42.984012225 +0100
-@@ -7018,7 +7018,7 @@
-     PR_MD_CSRCS=linux.c
-     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
-     DSO_CFLAGS=-fPIC
--    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
-+    DSO_LDOPTS='-shared -Wl,-z,origin -Wl,-rpath,\$$ORIGIN -Wl,-soname -Wl,$(notdir $@)'
-     _OPTIMIZE_FLAGS=-O2
-     _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
-                                    # combo is not yet good at debugging inlined
-diff -ru a/nss/cmd/platlibs.mk b/nss/cmd/platlibs.mk
---- a/a/nss/cmd/platlibs.mk	2014-09-29 16:46:38.306422654 +0100
-+++ b/b/nss/cmd/platlibs.mk	2014-09-29 16:47:42.987012253 +0100
+--- a/a/nss/cmd/platlibs.mk	2017-08-29 23:44:13.554044416 +0530
++++ b/b/nss/cmd/platlibs.mk	2017-08-29 23:46:09.638569150 +0530
 @@ -10,17 +10,22 @@
  
  ifeq ($(OS_ARCH), SunOS) 
@@ -51,10 +49,9 @@ diff -ru a/nss/cmd/platlibs.mk b/nss/cmd/platlibs.mk
  endif
  endif
  
-diff -ru nss.orig/nss/coreconf/arch.mk nss/nss/coreconf/arch.mk
---- a/nss.orig/nss/coreconf/arch.mk	2016-02-12 15:36:18.000000000 +0100
-+++ b/nss/nss/coreconf/arch.mk	2016-02-23 20:48:31.595941079 +0100
-@@ -280,11 +280,17 @@
+--- a/nss.org/nss/coreconf/arch.mk	2017-08-29 23:44:13.646044832 +0530
++++ b/nss/nss/coreconf/arch.mk	2017-08-29 23:45:51.494487134 +0530
+@@ -305,11 +305,17 @@
      OBJDIR_NAME_COMPILER = $(COMPILER_TAG)
  endif
  OBJDIR_NAME_BASE = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(OBJDIR_NAME_COMPILER)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG)
@@ -74,9 +71,8 @@ diff -ru nss.orig/nss/coreconf/arch.mk nss/nss/coreconf/arch.mk
  #
  # Define USE_DEBUG_RTL if you want to use the debug runtime library
  # (RTL) in the debug build
-diff -ru a/nss/coreconf/FreeBSD.mk b/nss/coreconf/FreeBSD.mk
---- a/a/nss/coreconf/FreeBSD.mk	2014-09-29 16:46:38.189421588 +0100
-+++ b/b/nss/coreconf/FreeBSD.mk	2014-09-29 16:47:42.984012225 +0100
+--- a/nss.org/nss/coreconf/FreeBSD.mk	2017-08-29 23:44:13.642044814 +0530
++++ b/nss/nss/coreconf/FreeBSD.mk	2017-08-29 23:45:20.850348615 +0530
 @@ -25,6 +25,7 @@
  
  DSO_CFLAGS		= -fPIC
@@ -85,19 +81,18 @@ diff -ru a/nss/coreconf/FreeBSD.mk b/nss/coreconf/FreeBSD.mk
  
  #
  # The default implementation strategy for FreeBSD is pthreads.
-diff -ru a/nss/coreconf/Linux.mk b/nss/coreconf/Linux.mk
---- a/a/nss/coreconf/Linux.mk	2014-09-29 16:46:38.189421588 +0100
-+++ b/b/nss/coreconf/Linux.mk	2014-09-29 16:47:42.985012235 +0100
-@@ -157,7 +160,7 @@
+--- a/nss.org/nss/coreconf/Linux.mk	2017-08-29 23:44:13.642044814 +0530
++++ b/nss/nss/coreconf/Linux.mk	2017-08-29 23:47:26.318915759 +0530
+@@ -147,7 +147,7 @@
+ # Also, -z defs conflicts with Address Sanitizer, which emits relocations
  # against the libsanitizer runtime built into the main executable.
  ZDEFS_FLAG		= -Wl,-z,defs
- ifneq ($(USE_ASAN),1)
 -DSO_LDOPTS		+= $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG))
-+DSO_LDOPTS             += $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG)) -Wl,-z,origin '-Wl,-rpath,$$ORIGIN'
- endif
- LDFLAGS			+= $(ARCHFLAG)
++DSO_LDOPTS		+= $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG)) $(if $(filter-out $(OS),ANDROID),-Wl$(COMMA)-z$(COMMA)origin '-Wl$(COMMA)-rpath$(COMMA)$$ORIGIN')
+ LDFLAGS			+= $(ARCHFLAG) -z noexecstack
  
-@@ -189,8 +192,13 @@
+ # On Maemo, we need to use the -rpath-link flag for even the standard system
+@@ -177,8 +177,13 @@
  endif
  endif
  
@@ -111,9 +106,8 @@ diff -ru a/nss/coreconf/Linux.mk b/nss/coreconf/Linux.mk
  
  # The -rpath '$$ORIGIN' linker option instructs this library to search for its
  # dependencies in the same directory where it resides.
-diff -ru a/nss/coreconf/rules.mk b/nss/coreconf/rules.mk
---- a/a/nss/coreconf/rules.mk	2014-09-29 16:46:38.188421578 +0100
-+++ b/b/nss/coreconf/rules.mk	2014-09-29 16:47:42.986012244 +0100
+--- a/nss.org/nss/coreconf/rules.mk	2017-08-29 23:44:13.646044832 +0530
++++ b/nss/nss/coreconf/rules.mk	2017-08-29 23:47:37.442966042 +0530
 @@ -261,7 +261,7 @@
  ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
  	$(AR) $(subst /,\\,$(OBJS))
@@ -123,34 +117,43 @@ diff -ru a/nss/coreconf/rules.mk b/nss/coreconf/rules.mk
  endif
  	$(RANLIB) $@
  
-diff -ru a/nss/coreconf/SunOS5.mk b/nss/coreconf/SunOS5.mk
---- a/a/nss/coreconf/SunOS5.mk	2014-09-29 16:46:38.175421471 +0100
-+++ b/b/nss/coreconf/SunOS5.mk	2014-09-29 16:47:42.985012235 +0100
-@@ -48,8 +48,12 @@
+--- a/nss.org/nss/coreconf/SunOS5.mk	2017-08-29 23:44:13.646044832 +0530
++++ b/nss/nss/coreconf/SunOS5.mk	2017-08-29 23:45:00.902258445 +0530
+@@ -48,8 +48,11 @@
  	    # OPTIMIZER += -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer
  	endif
  else
 -	CC         = cc
 -	CCC        = CC
-+# CC is taken from environment automatically.
-+#	CC         = cc
-+# Use CXX from environment.
-+#	CCC        = CC
-+        CCC       = $(CXX)
-+
++	# CC is taken from environment automatically.
++	#	CC         = cc
++	# Use CXX from environment.
++	#	CCC        = CC
++    CCC       = $(CXX)
  	ASFLAGS   += -Wa,-P
  	OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG)
  	ifndef BUILD_OPT
-diff -ru a/nss/Makefile b/nss/Makefile
---- a/a/nss/Makefile	2014-09-29 16:46:38.171421425 +0100
-+++ b/b/nss/Makefile	2014-09-29 16:47:42.987012253 +0100
+--- a/nss.org/nss/coreconf/Werror.mk	2017-08-29 23:44:13.646044832 +0530
++++ b/nss/nss/coreconf/Werror.mk	2017-08-29 23:44:23.994091608 +0530
+@@ -94,7 +94,8 @@
+     endif #ndef NSS_ENABLE_WERROR
+ 
+     ifeq ($(NSS_ENABLE_WERROR),1)
+-      WARNING_CFLAGS += -Werror
++      # We do not treat warnings as errors.
++	  # WARNING_CFLAGS += -Werror
+     else
+       # Old versions of gcc (< 4.8) don't support #pragma diagnostic in functions.
+       # Use this to disable use of that #pragma and the warnings it suppresses.
+--- a/nss.org/nss/Makefile	2017-08-29 23:44:13.402043729 +0530
++++ b/nss/nss/Makefile	2017-08-29 23:44:39.774162939 +0530
 @@ -1,3 +1,5 @@
 +export AR
 +export RANLIB
  #! gmake
  #
  # This Source Code Form is subject to the terms of the Mozilla Public
-@@ -91,10 +91,10 @@
+@@ -89,10 +91,10 @@
  NSPR_CONFIGURE_ENV = CC=gcc CXX=g++
  endif
  ifdef CC
@@ -163,16 +166,3 @@ diff -ru a/nss/Makefile b/nss/Makefile
  endif
  # Remove -arch definitions. NSPR can't handle that.
  NSPR_CONFIGURE_ENV := $(filter-out -arch x86_64,$(NSPR_CONFIGURE_ENV))
-diff -ru nss.orig/nss/coreconf/Werror.mk nss/nss/coreconf/Werror.mk
---- a/nss.orig/nss/coreconf/Werror.mk	2016-02-12 15:36:18.000000000 +0100
-+++ b/nss/nss/coreconf/Werror.mk	2016-02-23 23:58:15.119584046 +0100
-@@ -94,7 +94,8 @@
-     endif #ndef NSS_ENABLE_WERROR
- 
-     ifeq ($(NSS_ENABLE_WERROR),1)
--      WARNING_CFLAGS += -Werror
-+# We do not treat warnings as errors.
-+#    WARNING_CFLAGS += -Werror
-     else
-       # Old versions of gcc (< 4.8) don't support #pragma diagnostic in functions.
-       # Use this to disable use of that #pragma and the warnings it suppresses.
diff --git a/external/nss/nss.vs2015.patch b/external/nss/nss.vs2015.patch
index de4f8762fd5b..c3e6b5a5acaa 100644
--- a/external/nss/nss.vs2015.patch
+++ b/external/nss/nss.vs2015.patch
@@ -10,3 +10,13 @@ diff -ru nss.org/nss/coreconf/WIN32.mk nss/nss/coreconf/WIN32.mk
      ifeq ($(_MSC_VER_GE_12),1)
  	OS_CFLAGS += -FS
      endif
+--- a/nss/nss/gtests/nss_bogo_shim/nss_bogo_shim.cc	2018-08-08 11:08:42.922939267 +0200
++++ b/nss/nss/gtests/nss_bogo_shim/nss_bogo_shim.cc	2018-08-08 11:08:47.778929835 +0200
+@@ -6,6 +6,7 @@
+ #include "config.h"
+ 
+ #include <algorithm>
++#include <iterator>
+ #include <cstdlib>
+ #include <iostream>
+ #include <memory>
commit 0a02aab6d6c95384cb6aea6ffc4d5b6fe497e4aa
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Aug 2 21:18:15 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Aug 8 13:07:38 2018 +0200

    forcepoint#69 ditch any unclosed m_pPosAfterTOC before dropping cursor
    
    Reviewed-on: https://gerrit.libreoffice.org/58498
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit 71aae473c9c3cf15f75e2722afc7153a3af76d44)
    
    Change-Id: I6b56a48f5449b25fe3bdc2e02d3885388b0da74f
    (cherry picked from commit 9b2efcf761678e24cceefa6f87300f2ffe98fb19)

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index b03cea2ebaca..2d117c19eaa2 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5478,6 +5478,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss)
 
     SAL_WARN_IF(m_pTableEndPaM, "sw.ww8", "document ended without table ending");
     m_pTableEndPaM.reset();  //ensure this is deleted before pPaM
+    m_pPosAfterTOC.reset();
     mpCursor.reset();
     m_pPaM = nullptr;
     m_pLastAnchorPos.reset();//ensure this is deleted before UpdatePageDescs
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 6b5b65f927bb..f89f1d357f94 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1342,7 +1342,7 @@ private:
     // Indicate that current on loading a hyperlink, which is inside a TOC; Managed by Read_F_Hyperlink() and End_Field()
     bool m_bLoadingTOXHyperlink;
     // a document position recorded the after-position of TOC section, managed by Read_F_TOX() and End_Field()
-    SwPaM* m_pPosAfterTOC;
+    std::unique_ptr<SwPaM> m_pPosAfterTOC;
     // used for some dropcap tweaking
     SwTextNode* m_pPreviousNode;
 
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index e8b6307ba21e..853ec7c2619a 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -570,8 +570,7 @@ sal_uInt16 SwWW8ImplReader::End_Field()
                         if (m_pPosAfterTOC)
                         {
                             *m_pPaM = *m_pPosAfterTOC;
-                            delete m_pPosAfterTOC;
-                            m_pPosAfterTOC = nullptr;
+                            m_pPosAfterTOC.reset();
                         }
                     }
                 }
@@ -3403,11 +3402,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr )
 
     //The TOC field representation contents should be inserted into TOC section, but not after TOC section.
     //So we need update the document position when loading TOC representation and after loading TOC;
-    if (m_pPosAfterTOC)
-    {
-        delete m_pPosAfterTOC;
-    }
-    m_pPosAfterTOC = new SwPaM(*m_pPaM, m_pPaM);
+    m_pPosAfterTOC.reset(new SwPaM(*m_pPaM, m_pPaM));
     (*m_pPaM).Move(fnMoveBackward);
     SwPaM aRegion(*m_pPaM, m_pPaM);
 
commit 6115bf07f03e7779be552d14a62bb7e722daefb5
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 1 19:25:27 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Aug 8 13:07:32 2018 +0200

    forcepoint#66 make sure we don't get stuck endlessly reparsing
    
    Change-Id: Ie2733e8d7f73e5f6a072604c477e949cd944189a
    Reviewed-on: https://gerrit.libreoffice.org/58466
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit cc8140fe71becc92976167e2a96dbe1d727097dc)
    (cherry picked from commit fab30b5d512edf8d5252ddde4132b0f310431afd)

diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index 83560394ba4c..5661e605bee5 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -2226,9 +2226,14 @@ size_t PDFDictionaryElement::Parse(const std::vector< std::unique_ptr<PDFElement
             else if (!pDictionary->alreadyParsing())
             {
                 // Nested dictionary.
-                i = PDFDictionaryElement::Parse(rElements, pDictionary, pDictionary->m_aItems);
-                rDictionary[aName] = pDictionary;
-                aName.clear();
+                const size_t nexti
+                    = PDFDictionaryElement::Parse(rElements, pDictionary, pDictionary->m_aItems);
+                if (nexti >= i) // ensure we go forwards and not endlessly loop
+                {
+                    i = nexti;
+                    rDictionary[aName] = pDictionary;
+                    aName.clear();
+                }
             }
         }
 
commit dc5261be602b284227be727ba2c6318afd73641a
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 1 15:05:45 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Aug 8 13:07:24 2018 +0200

    forcepoint#66 protect against infinite parse recurse
    
    Reviewed-on: https://gerrit.libreoffice.org/58452
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit 171657a1f675268839526b1a13e5f3549fb73516)
    
    Change-Id: I0313cc141469a00b7d6a5bd15400e9d5a8f686cf
    (cherry picked from commit 9291178596c4e5165de51c0be5a525cbaa564140)

diff --git a/include/vcl/filter/pdfdocument.hxx b/include/vcl/filter/pdfdocument.hxx
index 48240b7ecb98..b684072fb1b4 100644
--- a/include/vcl/filter/pdfdocument.hxx
+++ b/include/vcl/filter/pdfdocument.hxx
@@ -37,9 +37,21 @@ class PDFNumberElement;
 /// A byte range in a PDF file.
 class VCL_DLLPUBLIC PDFElement
 {
+    bool m_bVisiting;
+    bool m_bParsing;
+
 public:
+    PDFElement()
+        : m_bVisiting(false)
+        , m_bParsing(false)
+    {
+    }
     virtual bool Read(SvStream& rStream) = 0;
     virtual ~PDFElement() { }
+    void setVisiting(bool bVisiting) { m_bVisiting = bVisiting; }
+    bool alreadyVisiting() const { return m_bVisiting; }
+    void setParsing(bool bParsing) { m_bParsing = bParsing; }
+    bool alreadyParsing() const { return m_bParsing; }
 };
 
 /// Indirect object: something with a unique ID.
@@ -49,7 +61,6 @@ class VCL_DLLPUBLIC PDFObjectElement : public PDFElement
     PDFDocument& m_rDoc;
     double m_fObjectValue;
     double m_fGenerationValue;
-    bool m_bVisiting;
     std::map<OString, PDFElement*> m_aDictionary;
     /// If set, the object contains this number element (outside any dictionary/array).
     PDFNumberElement* m_pNumberElement;
@@ -109,9 +120,6 @@ public:
     SvMemoryStream* GetStreamBuffer() const;
     void SetStreamBuffer(std::unique_ptr<SvMemoryStream>& pStreamBuffer);
     PDFDocument& GetDocument();
-
-    /// Visits the page tree recursively, looking for page objects.
-    void visitPages(std::vector<PDFObjectElement*>& rRet);
 };
 
 /// Array object: a list.
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index 20a2b951ab6c..83560394ba4c 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -1769,16 +1769,16 @@ const std::vector< std::unique_ptr<PDFElement> >& PDFDocument::GetElements()
 }
 
 /// Visits the page tree recursively, looking for page objects.
-void PDFObjectElement::visitPages(std::vector<PDFObjectElement*>& rRet)
+static void visitPages(PDFObjectElement* pPages, std::vector<PDFObjectElement*>& rRet)
 {
-    auto pKids = dynamic_cast<PDFArrayElement*>(Lookup("Kids"));
+    auto pKids = dynamic_cast<PDFArrayElement*>(pPages->Lookup("Kids"));
     if (!pKids)
     {
         SAL_WARN("vcl.filter", "visitPages: pages has no kids");
         return;
     }
 
-    m_bVisiting = true;
+    pPages->setVisiting(true);
 
     for (const auto& pKid : pKids->GetElements())
     {
@@ -1791,7 +1791,7 @@ void PDFObjectElement::visitPages(std::vector<PDFObjectElement*>& rRet)
             continue;
 
         // detect if visiting reenters itself
-        if (pKidObject->m_bVisiting)
+        if (pKidObject->alreadyVisiting())
         {
             SAL_WARN("vcl.filter", "visitPages: loop in hierarchy");
             continue;
@@ -1800,13 +1800,13 @@ void PDFObjectElement::visitPages(std::vector<PDFObjectElement*>& rRet)
         auto pName = dynamic_cast<PDFNameElement*>(pKidObject->Lookup("Type"));
         if (pName && pName->GetValue() == "Pages")
             // Pages inside pages: recurse.
-            pKidObject->visitPages(rRet);
+            visitPages(pKidObject, rRet);
         else
             // Found an actual page.
             rRet.push_back(pKidObject);
     }
 
-    m_bVisiting = false;
+    pPages->setVisiting(false);
 }
 
 std::vector<PDFObjectElement*> PDFDocument::GetPages()
@@ -1851,7 +1851,7 @@ std::vector<PDFObjectElement*> PDFDocument::GetPages()
         return aRet;
     }
 
-    pPages->visitPages(aRet);
+    visitPages(pPages, aRet);
 
     return aRet;
 }
@@ -2149,7 +2149,6 @@ PDFObjectElement::PDFObjectElement(PDFDocument& rDoc, double fObjectValue, doubl
     : m_rDoc(rDoc),
       m_fObjectValue(fObjectValue),
       m_fGenerationValue(fGenerationValue),
-      m_bVisiting(false),
       m_pNumberElement(nullptr),
       m_nDictionaryOffset(0),
       m_nDictionaryLength(0),
@@ -2177,6 +2176,8 @@ size_t PDFDictionaryElement::Parse(const std::vector< std::unique_ptr<PDFElement
     if (!rDictionary.empty())
         return nRet;
 
+    pThis->setParsing(true);
+
     auto pThisObject = dynamic_cast<PDFObjectElement*>(pThis);
     // This is set to non-nullptr here for nested dictionaries only.
     auto pThisDictionary = dynamic_cast<PDFDictionaryElement*>(pThis);
@@ -2222,7 +2223,7 @@ size_t PDFDictionaryElement::Parse(const std::vector< std::unique_ptr<PDFElement
                     pThisObject->SetDictionaryOffset(nDictionaryOffset);
                 }
             }
-            else
+            else if (!pDictionary->alreadyParsing())
             {
                 // Nested dictionary.
                 i = PDFDictionaryElement::Parse(rElements, pDictionary, pDictionary->m_aItems);
@@ -2396,6 +2397,8 @@ size_t PDFDictionaryElement::Parse(const std::vector< std::unique_ptr<PDFElement
         aNumbers.clear();
     }
 
+    pThis->setParsing(false);
+
     return nRet;
 }
 
commit 6c6a576d88c287abc1c678fdc30926ac8571237b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 1 12:04:30 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Aug 8 13:07:20 2018 +0200

    forcepoint#65 pdf page visiting revisits itself
    
    Change-Id: I6d9eb75f0850a94814fb4d69ea1442b826674496
    Reviewed-on: https://gerrit.libreoffice.org/58418
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit e6d5ef741c75895ed97801112823b8332557d79a)
    (cherry picked from commit d63463b0001cc6a439840d0cee36b6678aea467e)

diff --git a/include/vcl/filter/pdfdocument.hxx b/include/vcl/filter/pdfdocument.hxx
index 5011504f13df..48240b7ecb98 100644
--- a/include/vcl/filter/pdfdocument.hxx
+++ b/include/vcl/filter/pdfdocument.hxx
@@ -49,6 +49,7 @@ class VCL_DLLPUBLIC PDFObjectElement : public PDFElement
     PDFDocument& m_rDoc;
     double m_fObjectValue;
     double m_fGenerationValue;
+    bool m_bVisiting;
     std::map<OString, PDFElement*> m_aDictionary;
     /// If set, the object contains this number element (outside any dictionary/array).
     PDFNumberElement* m_pNumberElement;
@@ -108,6 +109,9 @@ public:
     SvMemoryStream* GetStreamBuffer() const;
     void SetStreamBuffer(std::unique_ptr<SvMemoryStream>& pStreamBuffer);
     PDFDocument& GetDocument();
+
+    /// Visits the page tree recursively, looking for page objects.
+    void visitPages(std::vector<PDFObjectElement*>& rRet);
 };
 
 /// Array object: a list.
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index b2c3a8577469..20a2b951ab6c 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -1769,15 +1769,17 @@ const std::vector< std::unique_ptr<PDFElement> >& PDFDocument::GetElements()
 }
 
 /// Visits the page tree recursively, looking for page objects.
-static void visitPages(PDFObjectElement* pPages, std::vector<PDFObjectElement*>& rRet)
+void PDFObjectElement::visitPages(std::vector<PDFObjectElement*>& rRet)
 {
-    auto pKids = dynamic_cast<PDFArrayElement*>(pPages->Lookup("Kids"));
+    auto pKids = dynamic_cast<PDFArrayElement*>(Lookup("Kids"));
     if (!pKids)
     {
         SAL_WARN("vcl.filter", "visitPages: pages has no kids");
         return;
     }
 
+    m_bVisiting = true;
+
     for (const auto& pKid : pKids->GetElements())
     {
         auto pReference = dynamic_cast<PDFReferenceElement*>(pKid);
@@ -1788,14 +1790,23 @@ static void visitPages(PDFObjectElement* pPages, std::vector<PDFObjectElement*>&
         if (!pKidObject)
             continue;
 
+        // detect if visiting reenters itself
+        if (pKidObject->m_bVisiting)
+        {
+            SAL_WARN("vcl.filter", "visitPages: loop in hierarchy");
+            continue;
+        }
+
         auto pName = dynamic_cast<PDFNameElement*>(pKidObject->Lookup("Type"));
         if (pName && pName->GetValue() == "Pages")
             // Pages inside pages: recurse.
-            visitPages(pKidObject, rRet);
+            pKidObject->visitPages(rRet);
         else
             // Found an actual page.
             rRet.push_back(pKidObject);
     }
+
+    m_bVisiting = false;
 }
 
 std::vector<PDFObjectElement*> PDFDocument::GetPages()
@@ -1840,7 +1851,7 @@ std::vector<PDFObjectElement*> PDFDocument::GetPages()
         return aRet;
     }
 
-    visitPages(pPages, aRet);
+    pPages->visitPages(aRet);
 
     return aRet;
 }
@@ -2138,6 +2149,7 @@ PDFObjectElement::PDFObjectElement(PDFDocument& rDoc, double fObjectValue, doubl
     : m_rDoc(rDoc),
       m_fObjectValue(fObjectValue),
       m_fGenerationValue(fGenerationValue),
+      m_bVisiting(false),
       m_pNumberElement(nullptr),
       m_nDictionaryOffset(0),
       m_nDictionaryLength(0),
commit 0ad2f3c452159df6a4d106a571534c4db69a6506
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 1 10:42:16 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Aug 8 13:07:15 2018 +0200

    forcepoint#59 the "matrix" is always one row in height
    
    so it can be a vector instead, and by using vector::at() instead of
    matrix::at() vector bounds checking is performed, unlike matrix::at()
    which does no checking
    
    Change-Id: Ic767c2dd884bffbf1cdff65c0980b21170612f4d
    Reviewed-on: https://gerrit.libreoffice.org/58399
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit ccfdc4b675233131fb99c998d2dc48affb0ac7af)
    (cherry picked from commit 58b4de56a389463eaef6dd228ffb7f37c1ba6103)

diff --git a/oox/source/drawingml/chart/chartconverter.cxx b/oox/source/drawingml/chart/chartconverter.cxx
index ff43fa7a5460..581608482b05 100644
--- a/oox/source/drawingml/chart/chartconverter.cxx
+++ b/oox/source/drawingml/chart/chartconverter.cxx
@@ -44,7 +44,6 @@ using ::oox::core::XmlFilterBase;
 
 static const sal_Unicode API_TOKEN_ARRAY_OPEN      = '{';
 static const sal_Unicode API_TOKEN_ARRAY_CLOSE     = '}';
-static const sal_Unicode API_TOKEN_ARRAY_ROWSEP    = '|';
 static const sal_Unicode API_TOKEN_ARRAY_COLSEP    = ';';
 
 // Code similar to oox/source/xls/formulabase.cxx
@@ -57,28 +56,23 @@ static OUString lclGenerateApiString( const OUString& rString )
     return "\"" + aRetString + "\"";
 }
 
-static OUString lclGenerateApiArray( const Matrix< Any >& rMatrix )
+static OUString lclGenerateApiArray(const std::vector<Any>& rRow)
 {
-    OSL_ENSURE( !rMatrix.empty(), "ChartConverter::lclGenerateApiArray - missing matrix values" );
+    OSL_ENSURE( !rRow.empty(), "ChartConverter::lclGenerateApiArray - missing matrix values" );
     OUStringBuffer aBuffer;
     aBuffer.append( API_TOKEN_ARRAY_OPEN );
-    for( size_t nRow = 0, nHeight = rMatrix.height(); nRow < nHeight; ++nRow )
+    for (auto aBeg = rRow.begin(), aIt = aBeg, aEnd = rRow.end(); aIt != aEnd; ++aIt)
     {
-        if( nRow > 0 )
-            aBuffer.append( API_TOKEN_ARRAY_ROWSEP );
-        for( Matrix< Any >::const_iterator aBeg = rMatrix.row_begin( nRow ), aIt = aBeg, aEnd = rMatrix.row_end( nRow ); aIt != aEnd; ++aIt )
-        {
-            double fValue = 0.0;
-            OUString aString;
-            if( aIt != aBeg )
-                aBuffer.append( API_TOKEN_ARRAY_COLSEP );
-            if( *aIt >>= fValue )
-                aBuffer.append( fValue );
-            else if( *aIt >>= aString )
-                aBuffer.append( lclGenerateApiString( aString ) );
-            else
-                aBuffer.append( "\"\"" );
-        }
+        double fValue = 0.0;
+        OUString aString;
+        if( aIt != aBeg )
+            aBuffer.append( API_TOKEN_ARRAY_COLSEP );
+        if( *aIt >>= fValue )
+            aBuffer.append( fValue );
+        else if( *aIt >>= aString )
+            aBuffer.append( lclGenerateApiString( aString ) );
+        else
+            aBuffer.append( "\"\"" );
     }
     aBuffer.append( API_TOKEN_ARRAY_CLOSE );
     return aBuffer.makeStringAndClear();
@@ -133,11 +127,11 @@ Reference< XDataSequence > ChartConverter::createDataSequence(
         if( !rDataSeq.maData.empty() )
         {
             // create a single-row array from constant source data
-            Matrix< Any > aMatrix( rDataSeq.mnPointCount, 1 );
-            for( DataSequenceModel::AnyMap::const_iterator aDIt = rDataSeq.maData.begin(), aDEnd = rDataSeq.maData.end(); aDIt != aDEnd; ++aDIt )
-                *aMatrix.at(aDIt->first, 0) = aDIt->second;
+            std::vector<Any> aRow(rDataSeq.mnPointCount);
+            for (auto const& elem : rDataSeq.maData)
+                aRow.at(elem.first) = elem.second;
 
-            aRangeRep = lclGenerateApiArray( aMatrix );
+            aRangeRep = lclGenerateApiArray(aRow);
         }
 
         if( !aRangeRep.isEmpty() ) try
commit f32ba7a73497e871353a69212c41ee99507b6f8a
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jul 24 14:20:20 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Aug 8 13:07:10 2018 +0200

    ofz#9431 don't check attribs of Invalid column
    
    Change-Id: I9c5adcadfa2a8593ff90622449d6bdfa4810f2c0
    Reviewed-on: https://gerrit.libreoffice.org/57917
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit d909146913c762c2cdb6bed52fbbd817c05681e9)
    (cherry picked from commit f4189f0dab25dbb61332d70c434485f8dc28be70)

diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 87018f11e8b5..1a2b4a273c20 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -146,7 +146,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
         SCCOL nCol = nStartCol + pE->nCol + nMergeColAdd;
         // Determine RowMerge
         // Pure ColMerge and ColMerge of the first MergeRow already done during parsing
-        if ( nRow <= nOverlapRowMax )
+        if (nRow <= nOverlapRowMax && ValidCol(nCol))
         {
             while ( nCol <= MAXCOL && mpDoc->HasAttrib( nCol, nRow, nTab,
                 nCol, nRow, nTab, HasAttrFlags::Overlapped ) )
commit 0e397dbc8a2d3490d3bde5a83c0dd60cc6cce420
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jul 25 09:09:15 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Aug 8 13:07:05 2018 +0200

    Resolves: tdf#118919 crash on double click ole object
    
    Change-Id: Id7b3df447db56f6f80d6255dabdcc7f6ab149e95
    Reviewed-on: https://gerrit.libreoffice.org/57956
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit d595829c64e149896d2b5e8a4974636f8d9bd892)
    (cherry picked from commit 960b781ba14af8286f49012b47515b5babfb8737)

diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index 11a037c0cd2f..7fdf68d36bf3 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -669,7 +669,7 @@ namespace
 {
     bool lcl_CopyStream(const uno::Reference<io::XInputStream>& xIn, const uno::Reference<io::XOutputStream>& xOut, sal_Int32 nMaxCopy = SAL_MAX_INT32)
     {
-        if (nMaxCopy == 0)
+        if (nMaxCopy <= 0)
             return false;
 
         const sal_Int32 nChunkSize = 4096;
commit 99d0076de2d39645a8e6e1c75c74b9a926cea7c5
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jul 24 14:47:14 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Aug 8 13:07:00 2018 +0200

    forcepoint#53 restrict to expected index range
    
    Change-Id: I22f01e5a3e3cf51b014ac841cd14071dce5baf0f
    Reviewed-on: https://gerrit.libreoffice.org/57922
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit fa82b6a5c74b527dc2aed9d3b63c997580cdb277)
    (cherry picked from commit d0f42b02c29c1e6aeeaa13d5f0d4a2e8b5ccb881)

diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 4d8d65f9501c..fa2fcd69b937 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -702,13 +702,18 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 
 bool CommonSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const
 {
-    int nCharCount = mnEndCharPos - mnMinCharPos;
+    const int nCharCount = mnEndCharPos - mnMinCharPos;
 
     for (int i = 0; i < nCharCount; ++i)
         pCharWidths[i] = 0;
 
     for (auto const& aGlyphItem : m_GlyphItems)
-        pCharWidths[aGlyphItem.mnCharPos - mnMinCharPos] += aGlyphItem.mnNewWidth;
+    {
+        const int nIndex = aGlyphItem.mnCharPos - mnMinCharPos;
+        if (nIndex >= nCharCount)
+            continue;
+        pCharWidths[nIndex] += aGlyphItem.mnNewWidth;
+    }
 
     return true;
 }
commit 2d1147546c033e5eecc6f3a26fd5a6d3665e5fc9
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jul 23 09:23:54 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Aug 8 13:06:54 2018 +0200

    ofz#9507 wrong start point for Johab block 59
    
    Change-Id: I011f4cbb10324c4a7d4e1be3ab1355291f79730b
    Reviewed-on: https://gerrit.libreoffice.org/57839
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit 6582602a126403185294afe9e3c2cd8479f9157b)
    (cherry picked from commit a4cb046a1247c6e0c321ba961330ab5ca2f8d50a)

diff --git a/sal/textenc/tcvtkr6.tab b/sal/textenc/tcvtkr6.tab
index 776c15dbcf5e..ac9c0d15293d 100644
--- a/sal/textenc/tcvtkr6.tab
+++ b/sal/textenc/tcvtkr6.tab
@@ -1013,7 +1013,7 @@ static ImplUniToDBCSHighTab const aJOHABDBCSHighTab[256] =
     { 0x06, 0xFA, aImplUniToDBCSTab_JOHAB_56 },                 /* 0x56 */
     { 0x03, 0xFC, aImplUniToDBCSTab_JOHAB_57 },                 /* 0x57 */
     { 0x00, 0xFD, aImplUniToDBCSTab_JOHAB_58 },                 /* 0x58 */
-    { 0x07, 0xFF, aImplUniToDBCSTab_JOHAB_59 },                 /* 0x59 */
+    { 0x0F, 0xFF, aImplUniToDBCSTab_JOHAB_59 },                 /* 0x59 */
     { 0x01, 0xE9, aImplUniToDBCSTab_JOHAB_5A },                 /* 0x5A */
     { 0x05, 0xFA, aImplUniToDBCSTab_JOHAB_5B },                 /* 0x5B */
     { 0x01, 0xFD, aImplUniToDBCSTab_JOHAB_5C },                 /* 0x5C */
commit 2283293d88a1bb9dcf27cad0c463442e5a1a5f36
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jun 26 12:15:19 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Aug 8 13:06:48 2018 +0200

    forcepoint#48 null deref
    
    Reviewed-on: https://gerrit.libreoffice.org/56463
    Tested-by: Jenkins
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    (cherry picked from commit 6725491ce8ef2e41feb9b732ad7ac366ba545ca9)
    
    Change-Id: I790fc6dafc0d8c9783b9dddc266b313af2a046d7
    (cherry picked from commit 5ef3fadd509766032cd402552153e9d5e743a22d)

diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index ff156d2fbd34..41766ab4b839 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -288,25 +288,25 @@ namespace
             ::sw::mark::AnnotationMark* const pAnnotationMark =
                 dynamic_cast< ::sw::mark::AnnotationMark* >(ppMark->get());
 
-            if ( pAnnotationMark == nullptr )
-            {
+            if (!pAnnotationMark)
                 continue;
-            }
 
             const SwPosition& rStartPos = pAnnotationMark->GetMarkStart();
-            if ( rStartPos.nNode == nOwnNode )
+            if (rStartPos.nNode != nOwnNode)
+                continue;
+
+            const SwFormatField* pAnnotationFormatField = pAnnotationMark->GetAnnotationFormatField();
+            if (!pAnnotationFormatField)
             {
-                const SwFormatField* pAnnotationFormatField = pAnnotationMark->GetAnnotationFormatField();
-                OSL_ENSURE( pAnnotationFormatField != nullptr, "<lcl_FillAnnotationStartArray(..)> - annotation fmt fld instance missing!" );
-                if ( pAnnotationFormatField != nullptr )
-                {
-                    rAnnotationStartArr.insert(
-                        std::make_shared<SwAnnotationStartPortion_Impl>(
-                                SwXTextField::CreateXTextField(&rDoc,
-                                    pAnnotationFormatField),
-                                rStartPos));
-                }
+                SAL_WARN("sw.core", "missing annotation format field");
+                continue;
             }
+
+            rAnnotationStartArr.insert(
+                std::make_shared<SwAnnotationStartPortion_Impl>(
+                        SwXTextField::CreateXTextField(&rDoc,
+                            pAnnotationFormatField),
+                        rStartPos));
         }
     }
 }
commit 38c7486d054c9547b87ea97167790c47539d4515
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jun 19 21:43:43 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Aug 8 13:06:41 2018 +0200

    forcepoint#50 fix end detection
    
    rBuffer.size() of 26, nBytes of 25, rBuffer[25] is the first zero
    so aLine.getLength() of 25, nBytes reduced by aLine.getLength()+1 and
    nRun increased by same, so nBytes wraps and nRun is 26.
    
    contains...
    
    forcepoint: rework to explore loop
    
    Change-Id: I14f6a3269fc3347a9976d899519e74f58d5975c8
    Reviewed-on: https://gerrit.libreoffice.org/56125
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 6e5e83025c948b699bb65839ef810a45a98ba014)
    
    Change-Id: Ia9f4789e081e6b77a21321f37d71cabfc7c84550
    Reviewed-on: https://gerrit.libreoffice.org/56481
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit 0cefb4f0552a9d1ec3afd64e695596480a1c9757)
    (cherry picked from commit c102d535021abd31d6dfaca4f58b2312b7ef4d08)

diff --git a/include/vcl/ppdparser.hxx b/include/vcl/ppdparser.hxx
index 134bb9bf49fa..3c64b159f928 100644
--- a/include/vcl/ppdparser.hxx
+++ b/include/vcl/ppdparser.hxx
@@ -273,7 +273,7 @@ public:
 
     // for printer setup
     char*   getStreamableBuffer( sal_uLong& rBytes ) const;
-    void    rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes );
+    void    rebuildFromStreamBuffer(const std::vector<char> &rBuffer);
 
     // convenience
     int getRenderResolution() const;
diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx
index 89673ba05b34..acad5897b9b4 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -279,8 +279,9 @@ bool JobData::constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, Jo
                     nBytes = aStream.ReadBytes(aRemain.data(), nBytes);
                     if (nBytes)
                     {
+                        aRemain.resize(nBytes+1);
                         aRemain[nBytes] = 0;
-                        rJobData.m_aContext.rebuildFromStreamBuffer(aRemain.data(), nBytes);
+                        rJobData.m_aContext.rebuildFromStreamBuffer(aRemain);
                         bContext = true;
                     }
                 }
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index bef9ab36e3fd..f27096e4da2f 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -1848,17 +1848,18 @@ char* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const
     return pBuffer;
 }
 
-void PPDContext::rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes )
+void PPDContext::rebuildFromStreamBuffer(const std::vector<char> &rBuffer)
 {
     if( ! m_pParser )
         return;
 
     m_aCurrentValues.clear();
 
-    char* pRun = pBuffer;
-    while( nBytes && *pRun )
+    const size_t nBytes = rBuffer.size() - 1;
+    size_t nRun = 0;
+    while (nRun < nBytes && rBuffer[nRun])
     {
-        OString aLine( pRun );
+        OString aLine(rBuffer.data() + nRun);
         sal_Int32 nPos = aLine.indexOf(':');
         if( nPos != -1 )
         {
@@ -1877,8 +1878,7 @@ void PPDContext::rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes )
                     << " }");
             }
         }
-        nBytes -= aLine.getLength()+1;
-        pRun += aLine.getLength()+1;
+        nRun += aLine.getLength()+1;
     }
 }
 


More information about the Libreoffice-commits mailing list