diff options
Diffstat (limited to 'gnu/packages/patches')
67 files changed, 1203 insertions, 5846 deletions
diff --git a/gnu/packages/patches/acl-fix-perl-regex.patch b/gnu/packages/patches/acl-fix-perl-regex.patch new file mode 100644 index 0000000000..f682abc058 --- /dev/null +++ b/gnu/packages/patches/acl-fix-perl-regex.patch @@ -0,0 +1,22 @@ +This can be removed with the next acl release + +--- + test/run | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/run b/test/run +index 2cf52e8..4627cd2 100755 +--- a/test/run ++++ b/test/run +@@ -70,7 +70,7 @@ for (;;) { + if (defined $line) { + # Substitute %VAR and %{VAR} with environment variables. + $line =~ s[%(\w+)][$ENV{$1}]eg; +- $line =~ s[%{(\w+)}][$ENV{$1}]eg; ++ $line =~ s[%\{(\w+)\}][$ENV{$1}]eg; + } + if (defined $line) { + if ($line =~ s/^\s*< ?//) { +-- +2.15.0 + diff --git a/gnu/packages/patches/automake-regexp-syntax.patch b/gnu/packages/patches/automake-regexp-syntax.patch deleted file mode 100644 index 2e965c8c50..0000000000 --- a/gnu/packages/patches/automake-regexp-syntax.patch +++ /dev/null @@ -1,34 +0,0 @@ -From <https://lists.gnu.org/archive/html/automake-patches/2015-07/msg00000.html>. -See also <http://bugs.gnu.org/22372>. - -From 34163794a58b5bd91c5d6bd9adf5437571c7a479 Mon Sep 17 00:00:00 2001 -From: Pavel Raiskup <praiskup@redhat.com> -Date: Tue, 7 Jul 2015 10:54:24 +0200 -Subject: [PATCH] bin/automake: escape '{' in regexp pattern - -Based on perlre(1) documentation: -.. in Perl v5.26, literal uses of a curly bracket will be required -to be escaped, say by preceding them with a backslash ("\{" ) or -enclosing them within square brackets ("[{]") .. - -References: -https://bugzilla.redhat.com/1239379 - -* bin/automake.in (substitute_ac_subst_variables): Escape the -occurrence of '{' character. ---- - bin/automake.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/bin/automake.in b/bin/automake.in -index 0c29184..c294ced 100644 ---- a/bin/automake.in -+++ b/bin/automake.in -@@ -3898,7 +3898,7 @@ sub substitute_ac_subst_variables_worker - sub substitute_ac_subst_variables - { - my ($text) = @_; -- $text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge; -+ $text =~ s/\$\{([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge; - return $text; - } diff --git a/gnu/packages/patches/automake-test-gzip-warning.patch b/gnu/packages/patches/automake-test-gzip-warning.patch deleted file mode 100644 index bcc9c207ae..0000000000 --- a/gnu/packages/patches/automake-test-gzip-warning.patch +++ /dev/null @@ -1,17 +0,0 @@ -Adjust test to ignore gzip 1.8+ warnings. - ---- automake-1.15/t/distcheck-no-prefix-or-srcdir-override.sh 2016-06-14 00:36:26.554218552 +0200 -+++ automake-1.15/t/distcheck-no-prefix-or-srcdir-override.sh 2016-06-14 00:37:52.903157770 +0200 -@@ -49,7 +49,11 @@ grep "cannot find sources.* in foobar" s - - ./configure - run_make -E -O distcheck --test ! -s stderr -+ -+# Gzip 1.8+ emits warnings like "gzip: warning: GZIP environment -+# variable is deprecated"; filter them out. -+test `grep -v '^gzip: warning' stderr | wc -l` -eq 0 -+ - # Sanity check: the flags have been actually seen. - $PERL -e 'undef $/; $_ = <>; s/ \\\n/ /g; print;' <stdout >t - grep '/configure .* --srcdir am-src' t || exit 99 diff --git a/gnu/packages/patches/avahi-localstatedir.patch b/gnu/packages/patches/avahi-localstatedir.patch index 76377d1057..a531e99b67 100644 --- a/gnu/packages/patches/avahi-localstatedir.patch +++ b/gnu/packages/patches/avahi-localstatedir.patch @@ -2,11 +2,11 @@ Don't "mkdir $(localstatedir)" since we can't do it (/var). --- avahi-0.6.27/avahi-daemon/Makefile.in 2010-07-13 05:06:35.000000000 +0200 +++ avahi-0.6.27/avahi-daemon/Makefile.in 2010-07-13 18:03:45.000000000 +0200 -@@ -1554,7 +1554,6 @@ xmllint: +@@ -1625,7 +1625,6 @@ done install-data-local: -- test -z "$(localstatedir)/run" || $(mkdir_p) "$(DESTDIR)$(localstatedir)/run" +- test -z "$(avahi_runtime_dir)" || $(MKDIR_P) "$(DESTDIR)$(avahi_runtime_dir)" update-systemd: curl http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c > sd-daemon.c diff --git a/gnu/packages/patches/clang-runtime-asan-build-fixes.patch b/gnu/packages/patches/clang-runtime-asan-build-fixes.patch new file mode 100644 index 0000000000..e9db57d7cb --- /dev/null +++ b/gnu/packages/patches/clang-runtime-asan-build-fixes.patch @@ -0,0 +1,92 @@ +This patch works around build issues in libsanitizer. Note that we carry the +same patches for GCC since it includes the same libsanitizer. + +Work around this build error on glibc 2.26: + + /tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/asan/asan_linux.cc: In function 'bool __asan::AsanInterceptsSignal(int)': + /tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/asan/asan_linux.cc:224:20: error: 'SIGSEGV' was not declared in this scope + +diff --git a/libsanitizer/asan/asan_linux.cc b/libsanitizer/asan/asan_linux.cc +index c504168..59087b9 100644 +--- a/lib/asan/asan_linux.cc ++++ b/lib/asan/asan_linux.cc +@@ -29,6 +29,7 @@ + #include <dlfcn.h> + #include <fcntl.h> + #include <pthread.h> ++#include <signal.h> + #include <stdio.h> + #include <unistd.h> + #include <unwind.h> + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Now, work around this other error: + + /tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: In function 'int __sanitizer::TracerThread(void*)': + /tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc:239:22: error: aggregate 'sigaltstack handler_stack' has incomplete type and cannot be defined + + +diff --git a/lib/sanitizer_common/sanitizer_linux.cc b/lib/sanitizer_common/sanitizer_linux.cc +index 2cefa20..223d9c6 100644 +--- a/lib/sanitizer_common/sanitizer_linux.cc ++++ b/lib/sanitizer_common/sanitizer_linux.cc +@@ -546,8 +546,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) { + } + #endif + +-uptr internal_sigaltstack(const struct sigaltstack *ss, +- struct sigaltstack *oss) { ++uptr internal_sigaltstack(const void *ss, void *oss) { + return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss); + } + +diff --git a/lib/sanitizer_common/sanitizer_linux.h b/lib/sanitizer_common/sanitizer_linux.h +index 4497702..1594058 100644 +--- a/lib/sanitizer_common/sanitizer_linux.h ++++ b/lib/sanitizer_common/sanitizer_linux.h +@@ -19,7 +19,6 @@ + #include "sanitizer_platform_limits_posix.h" + + struct link_map; // Opaque type returned by dlopen(). +-struct sigaltstack; + + namespace __sanitizer { + // Dirent structure for getdents(). Note that this structure is different from +@@ -28,8 +27,7 @@ struct linux_dirent; + + // Syscall wrappers. + uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count); +-uptr internal_sigaltstack(const struct sigaltstack* ss, +- struct sigaltstack* oss); ++uptr internal_sigaltstack(const void* ss, void* oss); + uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set, + __sanitizer_sigset_t *oldset); + void internal_sigfillset(__sanitizer_sigset_t *set); +diff --git a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc +index c919e4f..014162af 100644 +--- a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc ++++ b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc +@@ -267,7 +267,7 @@ static int TracerThread(void* argument) { + + // Alternate stack for signal handling. + InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize); +- struct sigaltstack handler_stack; ++ stack_t handler_stack; + internal_memset(&handler_stack, 0, sizeof(handler_stack)); + handler_stack.ss_sp = handler_stack_memory.data(); + handler_stack.ss_size = kHandlerStackSize; +diff --git a/lib/tsan/tsan_platform_linux.cc b/lib/tsan/tsan_platform_linux.cc +index 09cec5f..908f4fe 100644 +--- a/lib/tsan/rtl/tsan_platform_linux.cc ++++ b/lib/tsan/rtl/tsan_platform_linux.cc +@@ -291,7 +291,7 @@ bool IsGlobalVar(uptr addr) { + int ExtractResolvFDs(void *state, int *fds, int nfd) { + #if SANITIZER_LINUX + int cnt = 0; +- __res_state *statp = (__res_state*)state; ++ struct __res_state *statp = (struct __res_state*)state; + for (int i = 0; i < MAXNS && cnt < nfd; i++) { + if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1) + fds[cnt++] = statp->_u._ext.nssocks[i]; +-- +2.9.3 diff --git a/gnu/packages/patches/clang-runtime-esan-build-fixes.patch b/gnu/packages/patches/clang-runtime-esan-build-fixes.patch new file mode 100644 index 0000000000..743051ac15 --- /dev/null +++ b/gnu/packages/patches/clang-runtime-esan-build-fixes.patch @@ -0,0 +1,19 @@ +Fix esan compilation against glibc 2.26: + + /tmp/guix-build-clang-runtime-3.9.1.drv-0/compiler-rt-3.9.1.src/lib/esan/esan_sideline_linux.cpp: In static member function ‘static int __esan::SidelineThread::runSideline(void*)’: + /tmp/guix-build-clang-runtime-3.9.1.drv-0/compiler-rt-3.9.1.src/lib/esan/esan_sideline_linux.cpp:73:22: error: aggregate ‘__esan::SidelineThread::runSideline(void*)::sigaltstack SigAltStack’ has incomplete type and cannot be defined + +Patch from <https://github.com/google/sanitizers/issues/822>. + +index d04f5909d..bc272dfe4 100644 +--- a/lib/esan/esan_sideline_linux.cpp ++++ b/lib/esan/esan_sideline_linux.cpp +@@ -70,7 +70,7 @@ int SidelineThread::runSideline(void *Arg) { + + // Set up a signal handler on an alternate stack for safety. + InternalScopedBuffer<char> StackMap(SigAltStackSize); +- struct sigaltstack SigAltStack; ++ stack_t SigAltStack; + SigAltStack.ss_sp = StackMap.data(); + SigAltStack.ss_size = SigAltStackSize; + SigAltStack.ss_flags = 0; diff --git a/gnu/packages/patches/coreutils-cut-huge-range-test.patch b/gnu/packages/patches/coreutils-cut-huge-range-test.patch deleted file mode 100644 index e3a0ef28eb..0000000000 --- a/gnu/packages/patches/coreutils-cut-huge-range-test.patch +++ /dev/null @@ -1,33 +0,0 @@ -This patch fixes 100% reproducible test failures on arm-linux-gnueabihf in our -the build environment chroot, as reported at <https://bugs.gnu.org/26253>, -and now on x86_64-linux-gnu as well. It is a variant of this upstream patch: - - commit f5422009389678680dba9ff4ecb7d33632ee3383 - Author: Ludovic Courtès <ludo@gnu.org> - Date: Mon Mar 27 20:34:39 2017 -0700 - - tests: avoid false ulimit failure on some systems - - * tests/misc/cut-huge-range.sh: On some systems returns_ may - use more memory, so incorporate that in the determination - of the ulimit value to use. Noticed on ARMv7 with bash-4.4.12, - and x86_64 with bash-4.2.37. - Fixes http://bugs.gnu.org/26253 - -... which appeared to be insufficient. - -diff --git a/tests/misc/cut-huge-range.sh b/tests/misc/cut-huge-range.sh -index 6b3c5b6ed..55b7b640e 100755 ---- a/tests/misc/cut-huge-range.sh -+++ b/tests/misc/cut-huge-range.sh -@@ -20,9 +20,9 @@ - print_ver_ cut - getlimits_ - --vm=$(get_min_ulimit_v_ cut -b1 /dev/null) \ -+vm=$(get_min_ulimit_v_ sh -c 'cut -b1 /dev/null') \ - || skip_ "this shell lacks ulimit support" - vm=$(($vm + 1000)) # avoid spurious failures - - # sed script to subtract one from the input. - # Each input line should consist of a positive decimal number. diff --git a/gnu/packages/patches/diffutils-getopt.patch b/gnu/packages/patches/diffutils-getopt.patch new file mode 100644 index 0000000000..05c2504adf --- /dev/null +++ b/gnu/packages/patches/diffutils-getopt.patch @@ -0,0 +1,44 @@ +commit e3461d1c21a99bcef1b8826f710434e0ffb5adea +Author: Paul Eggert <eggert@cs.ucla.edu> +Date: Sun Jun 11 15:53:09 2017 -0700 + + getopt-posix: port to glibc 2.25.90 + + Problem reported by Daniel P. Berrange in: + http://lists.gnu.org/archive/html/bug-gnulib/2017-06/msg00003.html + * lib/getopt-pfx-core.h (_GETOPT_CORE_H): + * lib/getopt-pfx-ext.h (_GETOPT_EXT_H): + #undef if __GETOPT_PREFIX is defined. + +diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h +index 155c11612..6ad0da683 100644 +--- a/lib/getopt-pfx-core.h ++++ b/lib/getopt-pfx-core.h +@@ -47,6 +47,11 @@ + # define opterr __GETOPT_ID (opterr) + # define optind __GETOPT_ID (optind) + # define optopt __GETOPT_ID (optopt) ++ ++/* The system's getopt.h may have already included getopt-core.h to ++ declare the unprefixed identifiers. Undef _GETOPT_CORE_H so that ++ getopt-core.h declares them with prefixes. */ ++# undef _GETOPT_CORE_H + #endif + + #include <getopt-core.h> +diff --git a/lib/getopt-pfx-ext.h b/lib/getopt-pfx-ext.h +index d960bb34e..c5ac52202 100644 +--- a/lib/getopt-pfx-ext.h ++++ b/lib/getopt-pfx-ext.h +@@ -45,6 +45,11 @@ + # define getopt_long_only __GETOPT_ID (getopt_long_only) + # define option __GETOPT_ID (option) + # define _getopt_internal __GETOPT_ID (getopt_internal) ++ ++/* The system's getopt.h may have already included getopt-ext.h to ++ declare the unprefixed identifiers. Undef _GETOPT_EXT_H so that ++ getopt-ext.h declares them with prefixes. */ ++# undef _GETOPT_EXT_H + #endif + + /* Standalone applications get correct prototypes for getopt_long and diff --git a/gnu/packages/patches/docbook-xsl-nonrecursive-string-subst.patch b/gnu/packages/patches/docbook-xsl-nonrecursive-string-subst.patch new file mode 100644 index 0000000000..4199dd18a5 --- /dev/null +++ b/gnu/packages/patches/docbook-xsl-nonrecursive-string-subst.patch @@ -0,0 +1,39 @@ +Use a non-recursive replace function when the parser supports it. + +https://bugs.gnu.org/29782 +https://bugzilla.samba.org/show_bug.cgi?id=9515 +https://bugzilla.gnome.org/show_bug.cgi?id=736077 (for xsltproc) + +Patch copied from Debian: +https://anonscm.debian.org/cgit/collab-maint/docbook-xsl.git/tree/debian/patches/765567_non-recursive_string_subst.patch + +Description: use EXSLT "replace" function when available + A recursive implementation of string.subst is problematic, + long strings with many matches will cause stack overflows. +Author: Peter De Wachter <pdewacht@gmail.com> +Bug-Debian: https://bugs.debian.org/750593 + +--- a/lib/lib.xsl ++++ b/lib/lib.xsl +@@ -10,7 +10,10 @@ + This module implements DTD-independent functions + + ******************************************************************** --> +-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> ++<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ++ xmlns:str="http://exslt.org/strings" ++ exclude-result-prefixes="str" ++ version="1.0"> + + <xsl:template name="dot.count"> + <!-- Returns the number of "." characters in a string --> +@@ -56,6 +59,9 @@ + <xsl:param name="replacement"/> + + <xsl:choose> ++ <xsl:when test="function-available('str:replace')"> ++ <xsl:value-of select="str:replace($string, string($target), string($replacement))"/> ++ </xsl:when> + <xsl:when test="contains($string, $target)"> + <xsl:variable name="rest"> + <xsl:call-template name="string.subst"> diff --git a/gnu/packages/patches/findutils-gnulib-multi-core.patch b/gnu/packages/patches/findutils-gnulib-multi-core.patch deleted file mode 100644 index 5a37f4f1f9..0000000000 --- a/gnu/packages/patches/findutils-gnulib-multi-core.patch +++ /dev/null @@ -1,294 +0,0 @@ -This patch fixes performance problems on multi-core machines -as reported at <https://bugs.gnu.org/26441>. - -See commit 480d374e596a0ee3fed168ab42cd84c313ad3c89 in Gnulib -by Bruno Haible <bruno@clisp.org>. - -diff --git a/tests/test-lock.c b/tests/test-lock.c -index a992f64..fb18dee 100644 ---- a/tests/test-lock.c -+++ b/tests/test-lock.c -@@ -1,5 +1,5 @@ - /* Test of locking in multithreaded situations. -- Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc. -+ Copyright (C) 2005, 2008-2017 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by -@@ -50,6 +50,28 @@ - Uncomment this to see if the operating system has a fair scheduler. */ - #define EXPLICIT_YIELD 1 - -+/* Whether to use 'volatile' on some variables that communicate information -+ between threads. If set to 0, a semaphore or a lock is used to protect -+ these variables. If set to 1, 'volatile' is used; this is theoretically -+ equivalent but can lead to much slower execution (e.g. 30x slower total -+ run time on a 40-core machine), because 'volatile' does not imply any -+ synchronization/communication between different CPUs. */ -+#define USE_VOLATILE 0 -+ -+#if USE_POSIX_THREADS && HAVE_SEMAPHORE_H -+/* Whether to use a semaphore to communicate information between threads. -+ If set to 0, a lock is used. If set to 1, a semaphore is used. -+ Uncomment this to reduce the dependencies of this test. */ -+# define USE_SEMAPHORE 1 -+/* Mac OS X provides only named semaphores (sem_open); its facility for -+ unnamed semaphores (sem_init) does not work. */ -+# if defined __APPLE__ && defined __MACH__ -+# define USE_NAMED_SEMAPHORE 1 -+# else -+# define USE_UNNAMED_SEMAPHORE 1 -+# endif -+#endif -+ - /* Whether to print debugging messages. */ - #define ENABLE_DEBUGGING 0 - -@@ -90,6 +112,12 @@ - - #include "glthread/thread.h" - #include "glthread/yield.h" -+#if USE_SEMAPHORE -+# include <errno.h> -+# include <fcntl.h> -+# include <semaphore.h> -+# include <unistd.h> -+#endif - - #if ENABLE_DEBUGGING - # define dbgprintf printf -@@ -103,6 +131,132 @@ - # define yield() - #endif - -+#if USE_VOLATILE -+struct atomic_int { -+ volatile int value; -+}; -+static void -+init_atomic_int (struct atomic_int *ai) -+{ -+} -+static int -+get_atomic_int_value (struct atomic_int *ai) -+{ -+ return ai->value; -+} -+static void -+set_atomic_int_value (struct atomic_int *ai, int new_value) -+{ -+ ai->value = new_value; -+} -+#elif USE_SEMAPHORE -+/* This atomic_int implementation can only support the values 0 and 1. -+ It is initially 0 and can be set to 1 only once. */ -+# if USE_UNNAMED_SEMAPHORE -+struct atomic_int { -+ sem_t semaphore; -+}; -+#define atomic_int_semaphore(ai) (&(ai)->semaphore) -+static void -+init_atomic_int (struct atomic_int *ai) -+{ -+ sem_init (&ai->semaphore, 0, 0); -+} -+# endif -+# if USE_NAMED_SEMAPHORE -+struct atomic_int { -+ sem_t *semaphore; -+}; -+#define atomic_int_semaphore(ai) ((ai)->semaphore) -+static void -+init_atomic_int (struct atomic_int *ai) -+{ -+ sem_t *s; -+ unsigned int count; -+ for (count = 0; ; count++) -+ { -+ char name[80]; -+ /* Use getpid() in the name, so that different processes running at the -+ same time will not interfere. Use ai in the name, so that different -+ atomic_int in the same process will not interfere. Use a count in -+ the name, so that even in the (unlikely) case that a semaphore with -+ the specified name already exists, we can try a different name. */ -+ sprintf (name, "test-lock-%lu-%p-%u", -+ (unsigned long) getpid (), ai, count); -+ s = sem_open (name, O_CREAT | O_EXCL, 0600, 0); -+ if (s == SEM_FAILED) -+ { -+ if (errno == EEXIST) -+ /* Retry with a different name. */ -+ continue; -+ else -+ { -+ perror ("sem_open failed"); -+ abort (); -+ } -+ } -+ else -+ { -+ /* Try not to leave a semaphore hanging around on the file system -+ eternally, if we can avoid it. */ -+ sem_unlink (name); -+ break; -+ } -+ } -+ ai->semaphore = s; -+} -+# endif -+static int -+get_atomic_int_value (struct atomic_int *ai) -+{ -+ if (sem_trywait (atomic_int_semaphore (ai)) == 0) -+ { -+ if (sem_post (atomic_int_semaphore (ai))) -+ abort (); -+ return 1; -+ } -+ else if (errno == EAGAIN) -+ return 0; -+ else -+ abort (); -+} -+static void -+set_atomic_int_value (struct atomic_int *ai, int new_value) -+{ -+ if (new_value == 0) -+ /* It's already initialized with 0. */ -+ return; -+ /* To set the value 1: */ -+ if (sem_post (atomic_int_semaphore (ai))) -+ abort (); -+} -+#else -+struct atomic_int { -+ gl_lock_define (, lock) -+ int value; -+}; -+static void -+init_atomic_int (struct atomic_int *ai) -+{ -+ gl_lock_init (ai->lock); -+} -+static int -+get_atomic_int_value (struct atomic_int *ai) -+{ -+ gl_lock_lock (ai->lock); -+ int ret = ai->value; -+ gl_lock_unlock (ai->lock); -+ return ret; -+} -+static void -+set_atomic_int_value (struct atomic_int *ai, int new_value) -+{ -+ gl_lock_lock (ai->lock); -+ ai->value = new_value; -+ gl_lock_unlock (ai->lock); -+} -+#endif -+ - #define ACCOUNT_COUNT 4 - - static int account[ACCOUNT_COUNT]; -@@ -170,12 +324,12 @@ lock_mutator_thread (void *arg) - return NULL; - } - --static volatile int lock_checker_done; -+static struct atomic_int lock_checker_done; - - static void * - lock_checker_thread (void *arg) - { -- while (!lock_checker_done) -+ while (get_atomic_int_value (&lock_checker_done) == 0) - { - dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ()); - gl_lock_lock (my_lock); -@@ -200,7 +354,8 @@ test_lock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- lock_checker_done = 0; -+ init_atomic_int (&lock_checker_done); -+ set_atomic_int_value (&lock_checker_done, 0); - - /* Spawn the threads. */ - checkerthread = gl_thread_create (lock_checker_thread, NULL); -@@ -210,7 +365,7 @@ test_lock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- lock_checker_done = 1; -+ set_atomic_int_value (&lock_checker_done, 1); - gl_thread_join (checkerthread, NULL); - check_accounts (); - } -@@ -254,12 +409,12 @@ rwlock_mutator_thread (void *arg) - return NULL; - } - --static volatile int rwlock_checker_done; -+static struct atomic_int rwlock_checker_done; - - static void * - rwlock_checker_thread (void *arg) - { -- while (!rwlock_checker_done) -+ while (get_atomic_int_value (&rwlock_checker_done) == 0) - { - dbgprintf ("Checker %p before check rdlock\n", gl_thread_self_pointer ()); - gl_rwlock_rdlock (my_rwlock); -@@ -284,7 +439,8 @@ test_rwlock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- rwlock_checker_done = 0; -+ init_atomic_int (&rwlock_checker_done); -+ set_atomic_int_value (&rwlock_checker_done, 0); - - /* Spawn the threads. */ - for (i = 0; i < THREAD_COUNT; i++) -@@ -295,7 +451,7 @@ test_rwlock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- rwlock_checker_done = 1; -+ set_atomic_int_value (&rwlock_checker_done, 1); - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (checkerthreads[i], NULL); - check_accounts (); -@@ -356,12 +512,12 @@ reclock_mutator_thread (void *arg) - return NULL; - } - --static volatile int reclock_checker_done; -+static struct atomic_int reclock_checker_done; - - static void * - reclock_checker_thread (void *arg) - { -- while (!reclock_checker_done) -+ while (get_atomic_int_value (&reclock_checker_done) == 0) - { - dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ()); - gl_recursive_lock_lock (my_reclock); -@@ -386,7 +542,8 @@ test_recursive_lock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- reclock_checker_done = 0; -+ init_atomic_int (&reclock_checker_done); -+ set_atomic_int_value (&reclock_checker_done, 0); - - /* Spawn the threads. */ - checkerthread = gl_thread_create (reclock_checker_thread, NULL); -@@ -396,7 +553,7 @@ test_recursive_lock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- reclock_checker_done = 1; -+ set_atomic_int_value (&reclock_checker_done, 1); - gl_thread_join (checkerthread, NULL); - check_accounts (); - } diff --git a/gnu/packages/patches/fontconfig-remove-debug-printf.patch b/gnu/packages/patches/fontconfig-remove-debug-printf.patch new file mode 100644 index 0000000000..04924a45a4 --- /dev/null +++ b/gnu/packages/patches/fontconfig-remove-debug-printf.patch @@ -0,0 +1,18 @@ +Fontconfig 2.12.5 and 2.12.6 was released with a stray debugging statement. +See <https://lists.freedesktop.org/archives/fontconfig/2017-October/006079.html>. + +Patch copied from upstream source repository: +https://cgit.freedesktop.org/fontconfig/commit/?id=b56207a069be2574df455ede0a6ab61f44d5ca2b + +diff --git a/fc-query/fc-query.c b/fc-query/fc-query.c +index 842a8b6..6cd5abd 100644 +--- a/fc-query/fc-query.c ++++ b/fc-query/fc-query.c +@@ -170,7 +170,6 @@ main (int argc, char **argv) + FcPattern *pat; + + id = ((instance_num << 16) + face_num); +- printf("id %d\n", id); + if (FT_New_Face (ftLibrary, argv[i], id, &face)) + break; + num_faces = face->num_faces; diff --git a/gnu/packages/patches/fossil-CVE-2017-17459.patch b/gnu/packages/patches/fossil-CVE-2017-17459.patch deleted file mode 100644 index e566235b4e..0000000000 --- a/gnu/packages/patches/fossil-CVE-2017-17459.patch +++ /dev/null @@ -1,57 +0,0 @@ -Fix CVE-2017-17459: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17459 - -Patch copied from upstream source repository: - -https://www.fossil-scm.org/xfer/info/1f63db591c77108c - -Index: src/http_transport.c -================================================================== ---- src/http_transport.c -+++ src/http_transport.c -@@ -73,10 +73,23 @@ - if( resetFlag ){ - transport.nSent = 0; - transport.nRcvd = 0; - } - } -+ -+/* -+** Remove leading "-" characters from the input string. -+** -+** This prevents attacks that try to trick a victim into using -+** a ssh:// URI with a carefully crafted hostname of other -+** parameter that ends up being interpreted as a command-line -+** option by "ssh". -+*/ -+static const char *stripLeadingMinus(const char *z){ -+ while( z[0]=='-' ) z++; -+ return z; -+} - - /* - ** Default SSH command - */ - #ifdef _WIN32 -@@ -116,17 +129,17 @@ - }else{ - zHost = mprintf("%s", pUrlData->name); - } - n = blob_size(&zCmd); - blob_append(&zCmd, " ", 1); -- shell_escape(&zCmd, zHost); -+ shell_escape(&zCmd, stripLeadingMinus(zHost)); - blob_append(&zCmd, " ", 1); - shell_escape(&zCmd, mprintf("%s", pUrlData->fossil)); - blob_append(&zCmd, " test-http", 10); - if( pUrlData->path && pUrlData->path[0] ){ - blob_append(&zCmd, " ", 1); -- shell_escape(&zCmd, mprintf("%s", pUrlData->path)); -+ shell_escape(&zCmd, mprintf("%s", stripLeadingMinus(pUrlData->path))); - } - if( g.fSshTrace ){ - fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ - } - free(zHost); - diff --git a/gnu/packages/patches/gcc-asan-powerpc-missing-include.patch b/gnu/packages/patches/gcc-asan-missing-include.patch index 74b10c4a44..74b10c4a44 100644 --- a/gnu/packages/patches/gcc-asan-powerpc-missing-include.patch +++ b/gnu/packages/patches/gcc-asan-missing-include.patch diff --git a/gnu/packages/patches/gcc-fix-texi2pod.patch b/gnu/packages/patches/gcc-fix-texi2pod.patch new file mode 100644 index 0000000000..28bd56a382 --- /dev/null +++ b/gnu/packages/patches/gcc-fix-texi2pod.patch @@ -0,0 +1,19 @@ +This patch was taken from the official GCC git repository. +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=blobdiff_plain;f=contrib%2Ftexi2pod.pl;h=91bdbb5cea933d0381f2924ab94490fca31d5800;hp=eba1bcaa3cffa78b46030b219d04fe7d68367658;hb=67b56c905078d49d3e4028085e5cb1e1fb87a8aa;hpb=2f508a78310caab123e9794d3dcfe41f2769449b + +It fixes a defect in the contrib/texi2pod.pl script that prevented generating +manual pages. It was corrected in the GCC 6.X series. + +diff --git a/contrib/texi2pod.pl b/contrib/texi2pod.pl +index eba1bca..91bdbb5 100755 +--- a/contrib/texi2pod.pl ++++ b/contrib/texi2pod.pl +@@ -316,7 +316,7 @@ while(<$inf>) { + @columns = (); + for $column (split (/\s*\@tab\s*/, $1)) { + # @strong{...} is used a @headitem work-alike +- $column =~ s/^\@strong{(.*)}$/$1/; ++ $column =~ s/^\@strong\{(.*)\}$/$1/; + push @columns, $column; + } + $_ = "\n=item ".join (" : ", @columns)."\n"; diff --git a/gnu/packages/patches/gcc-libsanitizer-fix.patch b/gnu/packages/patches/gcc-libsanitizer-fix.patch new file mode 100644 index 0000000000..67aa44bed4 --- /dev/null +++ b/gnu/packages/patches/gcc-libsanitizer-fix.patch @@ -0,0 +1,113 @@ +https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=8937b94d1a643fd9760714642296d034a45254a8 +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066 + +This patch can be removed when gcc-6.5.0 is released + +From 8937b94d1a643fd9760714642296d034a45254a8 Mon Sep 17 00:00:00 2001 +From: doko <doko@138bc75d-0d04-0410-961f-82ee72b054a4> +Date: Thu, 7 Sep 2017 07:15:24 +0000 +Subject: [PATCH] 2017-09-07 Matthias Klose <doko@ubuntu.com> + + Backported from mainline + 2017-07-14 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/81066 + * sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969. + * sanitizer_common/sanitizer_linux.cc: Likewise. + * sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise. + * tsan/tsan_platform_linux.cc: Likewise. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@251828 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + libsanitizer/ChangeLog | 11 +++++++++++ + libsanitizer/sanitizer_common/sanitizer_linux.cc | 3 +-- + libsanitizer/sanitizer_common/sanitizer_linux.h | 4 +--- + .../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc | 2 +- + libsanitizer/tsan/tsan_platform_linux.cc | 2 +- + 5 files changed, 15 insertions(+), 7 deletions(-) + +diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog +index 252cd09..d988b28 100644 +--- a/libsanitizer/ChangeLog ++++ b/libsanitizer/ChangeLog +@@ -1,3 +1,14 @@ ++2017-09-07 Matthias Klose <doko@ubuntu.com> ++ ++ Backported from mainline ++ 2017-07-14 Jakub Jelinek <jakub@redhat.com> ++ ++ PR sanitizer/81066 ++ * sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969. ++ * sanitizer_common/sanitizer_linux.cc: Likewise. ++ * sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise. ++ * tsan/tsan_platform_linux.cc: Likewise. ++ + 2017-07-04 Release Manager + + * GCC 6.4.0 released. +diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc +index 2cefa20..223d9c6 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc +@@ -546,8 +546,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) { + } + #endif + +-uptr internal_sigaltstack(const struct sigaltstack *ss, +- struct sigaltstack *oss) { ++uptr internal_sigaltstack(const void *ss, void *oss) { + return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss); + } + +diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.h b/libsanitizer/sanitizer_common/sanitizer_linux.h +index 4497702..1594058 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_linux.h ++++ b/libsanitizer/sanitizer_common/sanitizer_linux.h +@@ -19,7 +19,6 @@ + #include "sanitizer_platform_limits_posix.h" + + struct link_map; // Opaque type returned by dlopen(). +-struct sigaltstack; + + namespace __sanitizer { + // Dirent structure for getdents(). Note that this structure is different from +@@ -28,8 +27,7 @@ struct linux_dirent; + + // Syscall wrappers. + uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count); +-uptr internal_sigaltstack(const struct sigaltstack* ss, +- struct sigaltstack* oss); ++uptr internal_sigaltstack(const void* ss, void* oss); + uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set, + __sanitizer_sigset_t *oldset); + void internal_sigfillset(__sanitizer_sigset_t *set); +diff --git a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc +index c919e4f..014162af 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc +@@ -267,7 +267,7 @@ static int TracerThread(void* argument) { + + // Alternate stack for signal handling. + InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize); +- struct sigaltstack handler_stack; ++ stack_t handler_stack; + internal_memset(&handler_stack, 0, sizeof(handler_stack)); + handler_stack.ss_sp = handler_stack_memory.data(); + handler_stack.ss_size = kHandlerStackSize; +diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc +index 09cec5f..908f4fe 100644 +--- a/libsanitizer/tsan/tsan_platform_linux.cc ++++ b/libsanitizer/tsan/tsan_platform_linux.cc +@@ -291,7 +291,7 @@ bool IsGlobalVar(uptr addr) { + int ExtractResolvFDs(void *state, int *fds, int nfd) { + #if SANITIZER_LINUX + int cnt = 0; +- __res_state *statp = (__res_state*)state; ++ struct __res_state *statp = (struct __res_state*)state; + for (int i = 0; i < MAXNS && cnt < nfd; i++) { + if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1) + fds[cnt++] = statp->_u._ext.nssocks[i]; +-- +2.9.3 + diff --git a/gnu/packages/patches/gettext-gnulib-multi-core.patch b/gnu/packages/patches/gettext-gnulib-multi-core.patch deleted file mode 100644 index 5ccdbe4ca1..0000000000 --- a/gnu/packages/patches/gettext-gnulib-multi-core.patch +++ /dev/null @@ -1,178 +0,0 @@ -This patch fixes performance problems on multi-core machines -as reported at <https://bugs.gnu.org/26441>. - -See commit 480d374e596a0ee3fed168ab42cd84c313ad3c89 in Gnulib -by Bruno Haible <bruno@clisp.org>. - -diff --git a/gettext-tools/gnulib-tests/test-lock.c b/gettext-tools/gnulib-tests/test-lock.c -index cb734b4e6..aa6de2739 100644 ---- a/gettext-tools/gnulib-tests/test-lock.c -+++ b/gettext-tools/gnulib-tests/test-lock.c -@@ -50,6 +50,13 @@ - Uncomment this to see if the operating system has a fair scheduler. */ - #define EXPLICIT_YIELD 1 - -+/* Whether to use 'volatile' on some variables that communicate information -+ between threads. If set to 0, a lock is used to protect these variables. -+ If set to 1, 'volatile' is used; this is theoretically equivalent but can -+ lead to much slower execution (e.g. 30x slower total run time on a 40-core -+ machine. */ -+#define USE_VOLATILE 0 -+ - /* Whether to print debugging messages. */ - #define ENABLE_DEBUGGING 0 - -@@ -103,6 +110,51 @@ - # define yield() - #endif - -+#if USE_VOLATILE -+struct atomic_int { -+ volatile int value; -+}; -+static void -+init_atomic_int (struct atomic_int *ai) -+{ -+} -+static int -+get_atomic_int_value (struct atomic_int *ai) -+{ -+ return ai->value; -+} -+static void -+set_atomic_int_value (struct atomic_int *ai, int new_value) -+{ -+ ai->value = new_value; -+} -+#else -+struct atomic_int { -+ gl_lock_define (, lock) -+ int value; -+}; -+static void -+init_atomic_int (struct atomic_int *ai) -+{ -+ gl_lock_init (ai->lock); -+} -+static int -+get_atomic_int_value (struct atomic_int *ai) -+{ -+ gl_lock_lock (ai->lock); -+ int ret = ai->value; -+ gl_lock_unlock (ai->lock); -+ return ret; -+} -+static void -+set_atomic_int_value (struct atomic_int *ai, int new_value) -+{ -+ gl_lock_lock (ai->lock); -+ ai->value = new_value; -+ gl_lock_unlock (ai->lock); -+} -+#endif -+ - #define ACCOUNT_COUNT 4 - - static int account[ACCOUNT_COUNT]; -@@ -170,12 +222,12 @@ lock_mutator_thread (void *arg) - return NULL; - } - --static volatile int lock_checker_done; -+static struct atomic_int lock_checker_done; - - static void * - lock_checker_thread (void *arg) - { -- while (!lock_checker_done) -+ while (get_atomic_int_value (&lock_checker_done) == 0) - { - dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ()); - gl_lock_lock (my_lock); -@@ -200,7 +252,8 @@ test_lock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- lock_checker_done = 0; -+ init_atomic_int (&lock_checker_done); -+ set_atomic_int_value (&lock_checker_done, 0); - - /* Spawn the threads. */ - checkerthread = gl_thread_create (lock_checker_thread, NULL); -@@ -210,7 +263,7 @@ test_lock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- lock_checker_done = 1; -+ set_atomic_int_value (&lock_checker_done, 1); - gl_thread_join (checkerthread, NULL); - check_accounts (); - } -@@ -254,12 +307,12 @@ rwlock_mutator_thread (void *arg) - return NULL; - } - --static volatile int rwlock_checker_done; -+static struct atomic_int rwlock_checker_done; - - static void * - rwlock_checker_thread (void *arg) - { -- while (!rwlock_checker_done) -+ while (get_atomic_int_value (&rwlock_checker_done) == 0) - { - dbgprintf ("Checker %p before check rdlock\n", gl_thread_self_pointer ()); - gl_rwlock_rdlock (my_rwlock); -@@ -284,7 +337,8 @@ test_rwlock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- rwlock_checker_done = 0; -+ init_atomic_int (&rwlock_checker_done); -+ set_atomic_int_value (&rwlock_checker_done, 0); - - /* Spawn the threads. */ - for (i = 0; i < THREAD_COUNT; i++) -@@ -295,7 +349,7 @@ test_rwlock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- rwlock_checker_done = 1; -+ set_atomic_int_value (&rwlock_checker_done, 1); - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (checkerthreads[i], NULL); - check_accounts (); -@@ -356,12 +410,12 @@ reclock_mutator_thread (void *arg) - return NULL; - } - --static volatile int reclock_checker_done; -+static struct atomic_int reclock_checker_done; - - static void * - reclock_checker_thread (void *arg) - { -- while (!reclock_checker_done) -+ while (get_atomic_int_value (&reclock_checker_done) == 0) - { - dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ()); - gl_recursive_lock_lock (my_reclock); -@@ -386,7 +440,8 @@ test_recursive_lock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- reclock_checker_done = 0; -+ init_atomic_int (&reclock_checker_done); -+ set_atomic_int_value (&reclock_checker_done, 0); - - /* Spawn the threads. */ - checkerthread = gl_thread_create (reclock_checker_thread, NULL); -@@ -396,7 +451,7 @@ test_recursive_lock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- reclock_checker_done = 1; -+ set_atomic_int_value (&reclock_checker_done, 1); - gl_thread_join (checkerthread, NULL); - check_accounts (); - } diff --git a/gnu/packages/patches/gettext-multi-core.patch b/gnu/packages/patches/gettext-multi-core.patch deleted file mode 100644 index 31a378cfd0..0000000000 --- a/gnu/packages/patches/gettext-multi-core.patch +++ /dev/null @@ -1,185 +0,0 @@ -This patch fixes performance problems on multi-core machines -as reported at <https://bugs.gnu.org/26441>. - -See commit 1afbcb06fded2a427b761dd1615b1e48e1e853cc in Gettext -by Bruno Haible <bruno@clisp.org>. - -diff --git a/gettext-runtime/tests/test-lock.c b/gettext-runtime/tests/test-lock.c -index d279d1d60..51cec3d6b 100644 ---- a/gettext-runtime/tests/test-lock.c -+++ b/gettext-runtime/tests/test-lock.c -@@ -1,5 +1,5 @@ - /* Test of locking in multithreaded situations. -- Copyright (C) 2005, 2008-2016 Free Software Foundation, Inc. -+ Copyright (C) 2005, 2008-2017 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by -@@ -50,6 +50,13 @@ - Uncomment this to see if the operating system has a fair scheduler. */ - #define EXPLICIT_YIELD 1 - -+/* Whether to use 'volatile' on some variables that communicate information -+ between threads. If set to 0, a lock is used to protect these variables. -+ If set to 1, 'volatile' is used; this is theoretically equivalent but can -+ lead to much slower execution (e.g. 30x slower total run time on a 40-core -+ machine. */ -+#define USE_VOLATILE 0 -+ - /* Whether to print debugging messages. */ - #define ENABLE_DEBUGGING 0 - -@@ -214,6 +221,51 @@ static inline void * gl_thread_self_pointer (void) - # define yield() - #endif - -+#if USE_VOLATILE -+struct atomic_int { -+ volatile int value; -+}; -+static void -+init_atomic_int (struct atomic_int *ai) -+{ -+} -+static int -+get_atomic_int_value (struct atomic_int *ai) -+{ -+ return ai->value; -+} -+static void -+set_atomic_int_value (struct atomic_int *ai, int new_value) -+{ -+ ai->value = new_value; -+} -+#else -+struct atomic_int { -+ gl_lock_define (, lock) -+ int value; -+}; -+static void -+init_atomic_int (struct atomic_int *ai) -+{ -+ gl_lock_init (ai->lock); -+} -+static int -+get_atomic_int_value (struct atomic_int *ai) -+{ -+ gl_lock_lock (ai->lock); -+ int ret = ai->value; -+ gl_lock_unlock (ai->lock); -+ return ret; -+} -+static void -+set_atomic_int_value (struct atomic_int *ai, int new_value) -+{ -+ gl_lock_lock (ai->lock); -+ ai->value = new_value; -+ gl_lock_unlock (ai->lock); -+} -+#endif -+ - #define ACCOUNT_COUNT 4 - - static int account[ACCOUNT_COUNT]; -@@ -281,12 +333,12 @@ lock_mutator_thread (void *arg) - return NULL; - } - --static volatile int lock_checker_done; -+static struct atomic_int lock_checker_done; - - static void * - lock_checker_thread (void *arg) - { -- while (!lock_checker_done) -+ while (get_atomic_int_value (&lock_checker_done) == 0) - { - dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ()); - gl_lock_lock (my_lock); -@@ -311,7 +363,8 @@ test_lock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- lock_checker_done = 0; -+ init_atomic_int (&lock_checker_done); -+ set_atomic_int_value (&lock_checker_done, 0); - - /* Spawn the threads. */ - checkerthread = gl_thread_create (lock_checker_thread, NULL); -@@ -321,7 +374,7 @@ test_lock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- lock_checker_done = 1; -+ set_atomic_int_value (&lock_checker_done, 1); - gl_thread_join (checkerthread, NULL); - check_accounts (); - } -@@ -365,12 +418,12 @@ rwlock_mutator_thread (void *arg) - return NULL; - } - --static volatile int rwlock_checker_done; -+static struct atomic_int rwlock_checker_done; - - static void * - rwlock_checker_thread (void *arg) - { -- while (!rwlock_checker_done) -+ while (get_atomic_int_value (&rwlock_checker_done) == 0) - { - dbgprintf ("Checker %p before check rdlock\n", gl_thread_self_pointer ()); - gl_rwlock_rdlock (my_rwlock); -@@ -395,7 +448,8 @@ test_rwlock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- rwlock_checker_done = 0; -+ init_atomic_int (&rwlock_checker_done); -+ set_atomic_int_value (&rwlock_checker_done, 0); - - /* Spawn the threads. */ - for (i = 0; i < THREAD_COUNT; i++) -@@ -406,7 +460,7 @@ test_rwlock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- rwlock_checker_done = 1; -+ set_atomic_int_value (&rwlock_checker_done, 1); - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (checkerthreads[i], NULL); - check_accounts (); -@@ -467,12 +521,12 @@ reclock_mutator_thread (void *arg) - return NULL; - } - --static volatile int reclock_checker_done; -+static struct atomic_int reclock_checker_done; - - static void * - reclock_checker_thread (void *arg) - { -- while (!reclock_checker_done) -+ while (get_atomic_int_value (&reclock_checker_done) == 0) - { - dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ()); - gl_recursive_lock_lock (my_reclock); -@@ -497,7 +551,8 @@ test_recursive_lock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- reclock_checker_done = 0; -+ init_atomic_int (&reclock_checker_done); -+ set_atomic_int_value (&reclock_checker_done, 0); - - /* Spawn the threads. */ - checkerthread = gl_thread_create (reclock_checker_thread, NULL); -@@ -507,7 +562,7 @@ test_recursive_lock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- reclock_checker_done = 1; -+ set_atomic_int_value (&reclock_checker_done, 1); - gl_thread_join (checkerthread, NULL); - check_accounts (); - } diff --git a/gnu/packages/patches/ghostscript-CVE-2017-8291.patch b/gnu/packages/patches/ghostscript-CVE-2017-8291.patch deleted file mode 100644 index d38bd593c0..0000000000 --- a/gnu/packages/patches/ghostscript-CVE-2017-8291.patch +++ /dev/null @@ -1,195 +0,0 @@ -Fix CVE-2017-8291: - -https://bugs.ghostscript.com/show_bug.cgi?id=697799 -https://bugs.ghostscript.com/show_bug.cgi?id=697808 (duplicate) -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8291 - -Patches copied from upstream source repository: - -https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=4f83478c88c2e05d6e8d79ca4557eb039354d2f3 -https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=04b37bbce174eed24edec7ad5b920eb93db4d47d -https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=57f20719e1cfaea77b67cb26e26de7fe4d7f9b2e -https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=ccfd2c75ac9be4cbd369e4cbdd40ba11a0c7bdad - -From 4f83478c88c2e05d6e8d79ca4557eb039354d2f3 Mon Sep 17 00:00:00 2001 -From: Chris Liddell <chris.liddell@artifex.com> -Date: Thu, 27 Apr 2017 13:03:33 +0100 -Subject: [PATCH] Bug 697799: have .eqproc check its parameters - -The Ghostscript custom operator .eqproc was not check the number or type of -the parameters it was given. ---- - psi/zmisc3.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/psi/zmisc3.c b/psi/zmisc3.c -index 54b304246..37293ff4b 100644 ---- a/psi/zmisc3.c -+++ b/psi/zmisc3.c -@@ -56,6 +56,12 @@ zeqproc(i_ctx_t *i_ctx_p) - ref2_t stack[MAX_DEPTH + 1]; - ref2_t *top = stack; - -+ if (ref_stack_count(&o_stack) < 2) -+ return_error(gs_error_stackunderflow); -+ if (!r_is_array(op - 1) || !r_is_array(op)) { -+ return_error(gs_error_typecheck); -+ } -+ - make_array(&stack[0].proc1, 0, 1, op - 1); - make_array(&stack[0].proc2, 0, 1, op); - for (;;) { --- -2.13.0 - -From 04b37bbce174eed24edec7ad5b920eb93db4d47d Mon Sep 17 00:00:00 2001 -From: Chris Liddell <chris.liddell@artifex.com> -Date: Thu, 27 Apr 2017 13:21:31 +0100 -Subject: [PATCH] Bug 697799: have .rsdparams check its parameters - -The Ghostscript internal operator .rsdparams wasn't checking the number or -type of the operands it was being passed. Do so. ---- - psi/zfrsd.c | 22 +++++++++++++++------- - 1 file changed, 15 insertions(+), 7 deletions(-) - -diff --git a/psi/zfrsd.c b/psi/zfrsd.c -index 191107d8a..950588d69 100644 ---- a/psi/zfrsd.c -+++ b/psi/zfrsd.c -@@ -49,13 +49,20 @@ zrsdparams(i_ctx_t *i_ctx_p) - ref *pFilter; - ref *pDecodeParms; - int Intent = 0; -- bool AsyncRead; -+ bool AsyncRead = false; - ref empty_array, filter1_array, parms1_array; - uint i; -- int code; -+ int code = 0; -+ -+ if (ref_stack_count(&o_stack) < 1) -+ return_error(gs_error_stackunderflow); -+ if (!r_has_type(op, t_dictionary) && !r_has_type(op, t_null)) { -+ return_error(gs_error_typecheck); -+ } - - make_empty_array(&empty_array, a_readonly); -- if (dict_find_string(op, "Filter", &pFilter) > 0) { -+ if (r_has_type(op, t_dictionary) -+ && dict_find_string(op, "Filter", &pFilter) > 0) { - if (!r_is_array(pFilter)) { - if (!r_has_type(pFilter, t_name)) - return_error(gs_error_typecheck); -@@ -94,12 +101,13 @@ zrsdparams(i_ctx_t *i_ctx_p) - return_error(gs_error_typecheck); - } - } -- code = dict_int_param(op, "Intent", 0, 3, 0, &Intent); -+ if (r_has_type(op, t_dictionary)) -+ code = dict_int_param(op, "Intent", 0, 3, 0, &Intent); - if (code < 0 && code != gs_error_rangecheck) /* out-of-range int is ok, use 0 */ - return code; -- if ((code = dict_bool_param(op, "AsyncRead", false, &AsyncRead)) < 0 -- ) -- return code; -+ if (r_has_type(op, t_dictionary)) -+ if ((code = dict_bool_param(op, "AsyncRead", false, &AsyncRead)) < 0) -+ return code; - push(1); - op[-1] = *pFilter; - if (pDecodeParms) --- -2.13.0 - -From 57f20719e1cfaea77b67cb26e26de7fe4d7f9b2e Mon Sep 17 00:00:00 2001 -From: Chris Liddell <chris.liddell@artifex.com> -Date: Wed, 3 May 2017 12:05:45 +0100 -Subject: [PATCH] Bug 697846: revision to commit 4f83478c88 (.eqproc) - -When using the "DELAYBIND" feature, it turns out that .eqproc can be called with -parameters that are not both procedures. In this case, it turns out, the -expectation is for the operator to return 'false', rather than throw an error. ---- - psi/zmisc3.c | 15 +++++++++++++-- - 1 file changed, 13 insertions(+), 2 deletions(-) - -diff --git a/psi/zmisc3.c b/psi/zmisc3.c -index 37293ff4b..3f01d39a3 100644 ---- a/psi/zmisc3.c -+++ b/psi/zmisc3.c -@@ -38,6 +38,15 @@ zcliprestore(i_ctx_t *i_ctx_p) - return gs_cliprestore(igs); - } - -+static inline bool -+eqproc_check_type(ref *r) -+{ -+ return r_has_type(r, t_array) -+ || r_has_type(r, t_mixedarray) -+ || r_has_type(r, t_shortarray) -+ || r_has_type(r, t_oparray); -+} -+ - /* <proc1> <proc2> .eqproc <bool> */ - /* - * Test whether two procedures are equal to depth 10. -@@ -58,8 +67,10 @@ zeqproc(i_ctx_t *i_ctx_p) - - if (ref_stack_count(&o_stack) < 2) - return_error(gs_error_stackunderflow); -- if (!r_is_array(op - 1) || !r_is_array(op)) { -- return_error(gs_error_typecheck); -+ if (!eqproc_check_type(op -1) || !eqproc_check_type(op)) { -+ make_false(op - 1); -+ pop(1); -+ return 0; - } - - make_array(&stack[0].proc1, 0, 1, op - 1); --- -2.13.0 - -From ccfd2c75ac9be4cbd369e4cbdd40ba11a0c7bdad Mon Sep 17 00:00:00 2001 -From: Chris Liddell <chris.liddell@artifex.com> -Date: Thu, 11 May 2017 14:07:48 +0100 -Subject: [PATCH] Bug 697892: fix check for op stack underflow. - -In the original fix, I used the wrong method to check for stack underflow, this -is using the correct method. ---- - psi/zfrsd.c | 3 +-- - psi/zmisc3.c | 3 +-- - 2 files changed, 2 insertions(+), 4 deletions(-) - -diff --git a/psi/zfrsd.c b/psi/zfrsd.c -index 950588d69..9c035b96d 100644 ---- a/psi/zfrsd.c -+++ b/psi/zfrsd.c -@@ -54,8 +54,7 @@ zrsdparams(i_ctx_t *i_ctx_p) - uint i; - int code = 0; - -- if (ref_stack_count(&o_stack) < 1) -- return_error(gs_error_stackunderflow); -+ check_op(1); - if (!r_has_type(op, t_dictionary) && !r_has_type(op, t_null)) { - return_error(gs_error_typecheck); - } -diff --git a/psi/zmisc3.c b/psi/zmisc3.c -index 3f01d39a3..43803b55b 100644 ---- a/psi/zmisc3.c -+++ b/psi/zmisc3.c -@@ -65,8 +65,7 @@ zeqproc(i_ctx_t *i_ctx_p) - ref2_t stack[MAX_DEPTH + 1]; - ref2_t *top = stack; - -- if (ref_stack_count(&o_stack) < 2) -- return_error(gs_error_stackunderflow); -+ check_op(2); - if (!eqproc_check_type(op -1) || !eqproc_check_type(op)) { - make_false(op - 1); - pop(1); --- -2.13.0 - diff --git a/gnu/packages/patches/glib-respect-datadir.patch b/gnu/packages/patches/glib-respect-datadir.patch new file mode 100644 index 0000000000..309ce9fc0b --- /dev/null +++ b/gnu/packages/patches/glib-respect-datadir.patch @@ -0,0 +1,21 @@ +On Guix, Python modules are in a different output from the executables, +so searching "../share/glib-2.0" will not work. + +This patch restores behaviour prior to this commit: +<https://git.gnome.org/browse/glib/commit/?id=fe2a9887a8ccb14f2386e01b14834e97a33bc2d7> + +--- a/gio/gdbus-2.0/codegen/gdbus-codegen.in ++++ b/gio/gdbus-2.0/codegen/gdbus-codegen.in +@@ -25,9 +25,12 @@ + + srcdir = os.getenv('UNINSTALLED_GLIB_SRCDIR', None) + filedir = os.path.dirname(__file__) ++datadir = os.path.join('@datadir@', 'glib-2.0') + + if srcdir is not None: + path = os.path.join(srcdir, 'gio', 'gdbus-2.0') ++elif os.path.exists(os.path.join(datadir, 'codegen')): ++ path = datadir + elif os.path.basename(filedir) == 'bin': + # Make the prefix containing gdbus-codegen 'relocatable' at runtime by + # adding /some/prefix/bin/../share/glib-2.0 to the python path diff --git a/gnu/packages/patches/glibc-CVE-2017-15670-15671.patch b/gnu/packages/patches/glibc-CVE-2017-15670-15671.patch deleted file mode 100644 index 76d688c517..0000000000 --- a/gnu/packages/patches/glibc-CVE-2017-15670-15671.patch +++ /dev/null @@ -1,27 +0,0 @@ -Fix CVE-2017-15670: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-15670 -https://sourceware.org/bugzilla/show_bug.cgi?id=22320 -https://bugzilla.redhat.com/show_bug.cgi?id=1504804 - -And CVE-2017-15671: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-15671 -https://sourceware.org/bugzilla/show_bug.cgi?id=22325 -https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2017-15671 - -Copied from upstream: -<https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=2d1bd71ec70a31b01d01b734faa66bb1ed28961f> - -diff --git a/posix/glob.c b/posix/glob.c ---- a/posix/glob.c -+++ b/posix/glob.c -@@ -843,7 +843,7 @@ - *p = '\0'; - } - else -- *((char *) mempcpy (newp, dirname + 1, end_name - dirname)) -+ *((char *) mempcpy (newp, dirname + 1, end_name - dirname - 1)) - = '\0'; - user_name = newp; - } diff --git a/gnu/packages/patches/gpm-glibc-2.26.patch b/gnu/packages/patches/gpm-glibc-2.26.patch new file mode 100644 index 0000000000..6caf7a01e0 --- /dev/null +++ b/gnu/packages/patches/gpm-glibc-2.26.patch @@ -0,0 +1,50 @@ +Fix building of GPM with glibc 2.26: + +https://bugs.gentoo.org/629774 + +Patches copied from Gentoo: + +https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-libs/gpm/files/gpm-1.20.7-glibc-2.26.patch?id=1618968c56caf7f8c08823908d88dc49bb8f7649 +https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-libs/gpm/files/gpm-1.20.7-sysmacros.patch?id=1618968c56caf7f8c08823908d88dc49bb8f7649 + +--- a/src/prog/gpm-root.y 2012-10-26 17:21:38.000000000 -0400 ++++ b/src/prog/gpm-root.y 2017-09-07 20:39:51.933264063 -0400 +@@ -1197,7 +1197,7 @@ + /* reap your zombies */ + childaction.sa_handler=reap_children; + #if defined(__GLIBC__) +- __sigemptyset(&childaction.sa_mask); ++ sigemptyset(&childaction.sa_mask); + #else /* __GLIBC__ */ + childaction.sa_mask=0; + #endif /* __GLIBC__ */ +From b350aee4ea5785a75cb6ad770f6b768c506ebb70 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@gentoo.org> +Date: Mon, 14 Mar 2016 15:39:54 -0400 +Subject: [PATCH] fix building w/newer glibc + +Linux C libraries are looking to disentangle sysmacros.h from the +sys/types.h include, so make sure we pull in the header when it is +found. +--- + src/daemon/open_console.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/daemon/open_console.c b/src/daemon/open_console.c +index 4d6c0af..6dd43e6 100644 +--- a/src/daemon/open_console.c ++++ b/src/daemon/open_console.c +@@ -24,6 +24,10 @@ + #include <sys/types.h> /* major() */ + #include <sys/ioctl.h> /* ioctl */ + ++#ifdef HAVE_SYS_SYSMACROS_H ++#include <sys/sysmacros.h> /* major() w/newer glibc */ ++#endif ++ + /* Linux specific (to be outsourced in gpm2 */ + #include <linux/serial.h> /* for serial console check */ + #include <asm/ioctls.h> /* for serial console check */ +-- +2.6.2 + diff --git a/gnu/packages/patches/grep-gnulib-lock.patch b/gnu/packages/patches/grep-gnulib-lock.patch deleted file mode 100644 index 68c33f1031..0000000000 --- a/gnu/packages/patches/grep-gnulib-lock.patch +++ /dev/null @@ -1,32 +0,0 @@ -This patch fix error on 'gnulib' library required to build -'grep' package on GNU/Hurd. -The patch was adapted from upstream source repository: -'<http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commit;h=4084b3a1094372b960ce4a97634e08f4538c8bdd>' - -Commit: 4084b3a1094372b960ce4a97634e08f4538c8bdd - -diff --git a/lib/glthread/lock.c b/lib/glthread/lock.c -index 061562b..afc86f4 100644 ---- a/lib/glthread/lock.c -+++ b/lib/glthread/lock.c -@@ -30,7 +30,7 @@ - - /* ------------------------- gl_rwlock_t datatype ------------------------- */ - --# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (__GNU_LIBRARY__ > 1)) -+# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1))) - - # ifdef PTHREAD_RWLOCK_INITIALIZER - -diff --git a/lib/glthread/lock.h b/lib/glthread/lock.h -index ec16d39..67932aa 100644 ---- a/lib/glthread/lock.h -+++ b/lib/glthread/lock.h -@@ -179,7 +179,7 @@ typedef pthread_mutex_t gl_lock_t; - - /* ------------------------- gl_rwlock_t datatype ------------------------- */ - --# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (__GNU_LIBRARY__ > 1)) -+# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1))) - - # ifdef PTHREAD_RWLOCK_INITIALIZER diff --git a/gnu/packages/patches/gtk2-fix-failing-test.patch b/gnu/packages/patches/gtk2-fix-failing-test.patch new file mode 100644 index 0000000000..721dc012c7 --- /dev/null +++ b/gnu/packages/patches/gtk2-fix-failing-test.patch @@ -0,0 +1,39 @@ +From 12d8b4e8f2f9c9a7707d1d3fccba382732212e3c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?G=C3=A1bor=20Boskovits?= <boskovits@gmail.com> +Date: Tue, 5 Dec 2017 20:06:36 +0100 +Subject: [PATCH] Fix test failing on new GLib versions. + +This test fails on newer GLib version, because GLib exports a new public marshaller. +The additional symbol making the test fail is: +g_cclosure_marshal_BOOLEAN__BOXED_BOXED + +The fix makes the test ignore non-gtk related abi. +This ensures if future marshallers are added to glib those will not pose a problem. + +The fix also ensures that the test still checks the gtk abi for identity, and +that the library provides a superset of the required abi. + +Upstream reponse to this problem was: + +GLib added a new marshaller in its public API +And the `abicheck.sh`in GTK+ 2.24 hasn't been updated because GTK+ 2.24 is in deep +maintenance mode and very few people test it against newer versions of GLib + +--- + gtk/abicheck.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gtk/abicheck.sh b/gtk/abicheck.sh +index 0d033fb..53b7bfe 100755 +--- a/gtk/abicheck.sh ++++ b/gtk/abicheck.sh +@@ -1,5 +1,5 @@ + #! /bin/sh + + cpp -DINCLUDE_VARIABLES -P -DG_OS_UNIX -DGTK_WINDOWING_X11 -DALL_FILES ${srcdir:-.}/gtk.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' -e 's/ PRIVATE//' | sort > expected-abi +-nm -D -g --defined-only .libs/libgtk-x11-2.0.so | cut -d ' ' -f 3 | egrep -v '^(__bss_start|_edata|_end)' | sort > actual-abi ++nm -D -g --defined-only .libs/libgtk-x11-2.0.so | cut -d ' ' -f 3 | egrep -v '^(__bss_start|_edata|_end)' | egrep '^gtk_' | sort > actual-abi + diff -u expected-abi actual-abi && rm -f expected-abi actual-abi +-- +2.15.0 + diff --git a/gnu/packages/patches/icecat-glibc-2.26.patch b/gnu/packages/patches/icecat-glibc-2.26.patch new file mode 100644 index 0000000000..45ebd5f700 --- /dev/null +++ b/gnu/packages/patches/icecat-glibc-2.26.patch @@ -0,0 +1,261 @@ +Fix compilation with glibc 2.26. Patch found +at <https://aur.archlinux.org/cgit/aur.git/plain/glibc-2.26-fix.diff?h=firefox-esr>, +adjusted so that file names match. + +From 6a0b7c8ecf0734ba1bcdccf8e0ee97e721fd5420 Mon Sep 17 00:00:00 2001 +Message-Id: <6a0b7c8ecf0734ba1bcdccf8e0ee97e721fd5420.1505113337.git.jan.steffens@gmail.com> +From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= <emilio@crisal.io> +Date: Sat, 19 Aug 2017 20:14:25 +0200 +Subject: [PATCH] Fix use of struct ucontext (squash 2 commits) + +Needed for building with glibc 2.26. + +Bug 1385667: Use ucontext_t consistently in breakpad-client. r=ted +MozReview-Commit-ID: AJhzJdNXP0f + +Bug 1394149: Fix remaining uses of ucontext in breakpad-client. r=ted +MozReview-Commit-ID: 5tP7fXsI7dQ +--- + .../linux/dump_writer_common/ucontext_reader.cc | 30 +++++++++++----------- + .../linux/dump_writer_common/ucontext_reader.h | 10 ++++---- + .../linux/handler/exception_handler.cc | 10 ++++---- + .../linux/handler/exception_handler.h | 2 +- + .../linux/microdump_writer/microdump_writer.cc | 2 +- + .../linux/minidump_writer/minidump_writer.cc | 2 +- + 6 files changed, 28 insertions(+), 28 deletions(-) + +diff --git a/toolkit/crashreporter/google-breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/toolkit/crashreporter/google-breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc +index 999960912e459e1b..303c0ebd32b663c4 100644 +--- a/toolkit/crashreporter/google-breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc ++++ b/toolkit/crashreporter/google-breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc +@@ -40,15 +40,15 @@ namespace google_breakpad { + + #if defined(__i386__) + +-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) { ++uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) { + return uc->uc_mcontext.gregs[REG_ESP]; + } + +-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) { ++uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { + return uc->uc_mcontext.gregs[REG_EIP]; + } + +-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc, ++void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc, + const struct _libc_fpstate* fp) { + const greg_t* regs = uc->uc_mcontext.gregs; + +@@ -88,15 +88,15 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc, + + #elif defined(__x86_64) + +-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) { ++uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) { + return uc->uc_mcontext.gregs[REG_RSP]; + } + +-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) { ++uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { + return uc->uc_mcontext.gregs[REG_RIP]; + } + +-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc, ++void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc, + const struct _libc_fpstate* fpregs) { + const greg_t* regs = uc->uc_mcontext.gregs; + +@@ -145,15 +145,15 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc, + + #elif defined(__ARM_EABI__) + +-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) { ++uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) { + return uc->uc_mcontext.arm_sp; + } + +-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) { ++uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { + return uc->uc_mcontext.arm_pc; + } + +-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) { ++void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) { + out->context_flags = MD_CONTEXT_ARM_FULL; + + out->iregs[0] = uc->uc_mcontext.arm_r0; +@@ -184,41 +184,41 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) { + + #elif defined(__aarch64__) + +-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) { ++uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) { + return uc->uc_mcontext.sp; + } + +-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) { ++uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { + return uc->uc_mcontext.pc; + } + +-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc, ++void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc, + const struct fpsimd_context* fpregs) { + out->context_flags = MD_CONTEXT_ARM64_FULL; + + out->cpsr = static_cast<uint32_t>(uc->uc_mcontext.pstate); + for (int i = 0; i < MD_CONTEXT_ARM64_REG_SP; ++i) + out->iregs[i] = uc->uc_mcontext.regs[i]; + out->iregs[MD_CONTEXT_ARM64_REG_SP] = uc->uc_mcontext.sp; + out->iregs[MD_CONTEXT_ARM64_REG_PC] = uc->uc_mcontext.pc; + + out->float_save.fpsr = fpregs->fpsr; + out->float_save.fpcr = fpregs->fpcr; + my_memcpy(&out->float_save.regs, &fpregs->vregs, + MD_FLOATINGSAVEAREA_ARM64_FPR_COUNT * 16); + } + + #elif defined(__mips__) + +-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) { ++uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) { + return uc->uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]; + } + +-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) { ++uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { + return uc->uc_mcontext.pc; + } + +-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) { ++void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) { + #if _MIPS_SIM == _ABI64 + out->context_flags = MD_CONTEXT_MIPS64_FULL; + #elif _MIPS_SIM == _ABIO32 +diff --git a/toolkit/crashreporter/google-breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/toolkit/crashreporter/google-breakpad/src/client/linux/dump_writer_common/ucontext_reader.h +index c533e28ba7441e83..039752a2dfb6e589 100644 +--- a/toolkit/crashreporter/google-breakpad/src/client/linux/dump_writer_common/ucontext_reader.h ++++ b/toolkit/crashreporter/google-breakpad/src/client/linux/dump_writer_common/ucontext_reader.h +@@ -41,21 +41,21 @@ namespace google_breakpad { + + // Wraps platform-dependent implementations of accessors to ucontext structs. + struct UContextReader { +- static uintptr_t GetStackPointer(const struct ucontext* uc); ++ static uintptr_t GetStackPointer(const ucontext_t* uc); + +- static uintptr_t GetInstructionPointer(const struct ucontext* uc); ++ static uintptr_t GetInstructionPointer(const ucontext_t* uc); + + // Juggle a arch-specific ucontext into a minidump format + // out: the minidump structure + // info: the collection of register structures. + #if defined(__i386__) || defined(__x86_64) +- static void FillCPUContext(RawContextCPU *out, const ucontext *uc, ++ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc, + const struct _libc_fpstate* fp); + #elif defined(__aarch64__) +- static void FillCPUContext(RawContextCPU *out, const ucontext *uc, ++ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc, + const struct fpsimd_context* fpregs); + #else +- static void FillCPUContext(RawContextCPU *out, const ucontext *uc); ++ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc); + #endif + }; + +diff --git a/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc b/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc +index 71a51a763938e39d..12df9bc96ec45fea 100644 +--- a/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc ++++ b/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc +@@ -439,44 +439,44 @@ bool ExceptionHandler::HandleSignal(int sig, siginfo_t* info, void* uc) { + // Fill in all the holes in the struct to make Valgrind happy. + memset(&g_crash_context_, 0, sizeof(g_crash_context_)); + memcpy(&g_crash_context_.siginfo, info, sizeof(siginfo_t)); +- memcpy(&g_crash_context_.context, uc, sizeof(struct ucontext)); ++ memcpy(&g_crash_context_.context, uc, sizeof(ucontext_t)); + #if defined(__aarch64__) +- struct ucontext* uc_ptr = (struct ucontext*)uc; ++ ucontext_t* uc_ptr = (ucontext_t*)uc; + struct fpsimd_context* fp_ptr = + (struct fpsimd_context*)&uc_ptr->uc_mcontext.__reserved; + if (fp_ptr->head.magic == FPSIMD_MAGIC) { + memcpy(&g_crash_context_.float_state, fp_ptr, + sizeof(g_crash_context_.float_state)); + } + #elif !defined(__ARM_EABI__) && !defined(__mips__) + // FP state is not part of user ABI on ARM Linux. +- // In case of MIPS Linux FP state is already part of struct ucontext ++ // In case of MIPS Linux FP state is already part of ucontext_t + // and 'float_state' is not a member of CrashContext. +- struct ucontext* uc_ptr = (struct ucontext*)uc; ++ ucontext_t* uc_ptr = (ucontext_t*)uc; + if (uc_ptr->uc_mcontext.fpregs) { + memcpy(&g_crash_context_.float_state, uc_ptr->uc_mcontext.fpregs, + sizeof(g_crash_context_.float_state)); + } + #endif + g_crash_context_.tid = syscall(__NR_gettid); + if (crash_handler_ != NULL) { + if (crash_handler_(&g_crash_context_, sizeof(g_crash_context_), + callback_context_)) { + return true; + } + } + return GenerateDump(&g_crash_context_); + } + + // This is a public interface to HandleSignal that allows the client to + // generate a crash dump. This function may run in a compromised context. + bool ExceptionHandler::SimulateSignalDelivery(int sig) { + siginfo_t siginfo = {}; + // Mimic a trusted signal to allow tracing the process (see + // ExceptionHandler::HandleSignal(). + siginfo.si_code = SI_USER; + siginfo.si_pid = getpid(); +- struct ucontext context; ++ ucontext_t context; + getcontext(&context); + return HandleSignal(sig, &siginfo, &context); + } +diff --git a/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.h b/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.h +index 711586fec7ddae59..be1880170e2826b0 100644 +--- a/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.h ++++ b/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.h +@@ -191,7 +191,7 @@ class ExceptionHandler { + struct CrashContext { + siginfo_t siginfo; + pid_t tid; // the crashing thread. +- struct ucontext context; ++ ucontext_t context; + #if !defined(__ARM_EABI__) && !defined(__mips__) + // #ifdef this out because FP state is not part of user ABI for Linux ARM. + // In case of MIPS Linux FP state is already part of struct +diff --git a/toolkit/crashreporter/google-breakpad/src/client/linux/microdump_writer/microdump_writer.cc b/toolkit/crashreporter/google-breakpad/src/client/linux/microdump_writer/microdump_writer.cc +index ff20bf36584c876b..a0b90e08fc5f0cff 100644 +--- a/toolkit/crashreporter/google-breakpad/src/client/linux/microdump_writer/microdump_writer.cc ++++ b/toolkit/crashreporter/google-breakpad/src/client/linux/microdump_writer/microdump_writer.cc +@@ -571,7 +571,7 @@ class MicrodumpWriter { + + void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); } + +- const struct ucontext* const ucontext_; ++ const ucontext_t* const ucontext_; + #if !defined(__ARM_EABI__) && !defined(__mips__) + const google_breakpad::fpstate_t* const float_state_; + #endif +diff --git a/toolkit/crashreporter/google-breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/toolkit/crashreporter/google-breakpad/src/client/linux/minidump_writer/minidump_writer.cc +index 0650bb95c179464a..6b5304bcd605ca3a 100644 +--- a/toolkit/crashreporter/google-breakpad/src/client/linux/minidump_writer/minidump_writer.cc ++++ b/toolkit/crashreporter/google-breakpad/src/client/linux/minidump_writer/minidump_writer.cc +@@ -1247,7 +1247,7 @@ class MinidumpWriter { + const int fd_; // File descriptor where the minidum should be written. + const char* path_; // Path to the file where the minidum should be written. + +- const struct ucontext* const ucontext_; // also from the signal handler ++ const ucontext_t* const ucontext_; // also from the signal handler + #if !defined(__ARM_EABI__) && !defined(__mips__) + const google_breakpad::fpstate_t* const float_state_; // ditto + #endif +-- +2.14.1 diff --git a/gnu/packages/patches/icu4c-CVE-2017-14952.patch b/gnu/packages/patches/icu4c-CVE-2017-14952.patch deleted file mode 100644 index 564f69d01d..0000000000 --- a/gnu/packages/patches/icu4c-CVE-2017-14952.patch +++ /dev/null @@ -1,18 +0,0 @@ -Fix CVE-2017-14952: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-14952 - -Patch copied from upstream source repository: - -http://bugs.icu-project.org/trac/changeset/40324/trunk/icu4c/source/i18n/zonemeta.cpp#file0 - -Index: trunk/icu4c/source/i18n/zonemeta.cpp -=================================================================== ---- icu/source/i18n/zonemeta.cpp (revision 40283) -+++ icu/source/i18n/zonemeta.cpp (revision 40324) -@@ -691,5 +691,4 @@ - if (U_FAILURE(status)) { - delete mzMappings; -- deleteOlsonToMetaMappingEntry(entry); - uprv_free(entry); - break; diff --git a/gnu/packages/patches/icu4c-CVE-2017-7867-CVE-2017-7868.patch b/gnu/packages/patches/icu4c-CVE-2017-7867-CVE-2017-7868.patch deleted file mode 100644 index 4db8f27998..0000000000 --- a/gnu/packages/patches/icu4c-CVE-2017-7867-CVE-2017-7868.patch +++ /dev/null @@ -1,164 +0,0 @@ -Fix CVE-2017-7867 and CVE-2017-7868: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7867 -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7868 - -Patch copied from upstream source repository: - -http://bugs.icu-project.org/trac/changeset/39671 - -Index: icu/source/common/utext.cpp -=================================================================== ---- icu/source/common/utext.cpp (revision 39670) -+++ icu/source/common/utext.cpp (revision 39671) -@@ -848,7 +848,13 @@ - - // Chunk size. --// Must be less than 85, because of byte mapping from UChar indexes to native indexes. --// Worst case is three native bytes to one UChar. (Supplemenaries are 4 native bytes --// to two UChars.) -+// Must be less than 42 (256/6), because of byte mapping from UChar indexes to native indexes. -+// Worst case there are six UTF-8 bytes per UChar. -+// obsolete 6 byte form fd + 5 trails maps to fffd -+// obsolete 5 byte form fc + 4 trails maps to fffd -+// non-shortest 4 byte forms maps to fffd -+// normal supplementaries map to a pair of utf-16, two utf8 bytes per utf-16 unit -+// mapToUChars array size must allow for the worst case, 6. -+// This could be brought down to 4, by treating fd and fc as pure illegal, -+// rather than obsolete lead bytes. But that is not compatible with the utf-8 access macros. - // - enum { UTF8_TEXT_CHUNK_SIZE=32 }; -@@ -890,5 +896,5 @@ - // one for a supplementary starting in the last normal position, - // and one for an entry for the buffer limit position. -- uint8_t mapToUChars[UTF8_TEXT_CHUNK_SIZE*3+6]; // Map native offset from bufNativeStart to -+ uint8_t mapToUChars[UTF8_TEXT_CHUNK_SIZE*6+6]; // Map native offset from bufNativeStart to - // correspoding offset in filled part of buf. - int32_t align; -@@ -1033,4 +1039,5 @@ - u8b = (UTF8Buf *)ut->p; // the current buffer - mapIndex = ix - u8b->toUCharsMapStart; -+ U_ASSERT(mapIndex < (int32_t)sizeof(UTF8Buf::mapToUChars)); - ut->chunkOffset = u8b->mapToUChars[mapIndex] - u8b->bufStartIdx; - return TRUE; -@@ -1299,4 +1306,8 @@ - // If index is at the end, there is no character there to look at. - if (ix != ut->b) { -+ // Note: this function will only move the index back if it is on a trail byte -+ // and there is a preceding lead byte and the sequence from the lead -+ // through this trail could be part of a valid UTF-8 sequence -+ // Otherwise the index remains unchanged. - U8_SET_CP_START(s8, 0, ix); - } -@@ -1312,5 +1323,8 @@ - uint8_t *mapToNative = u8b->mapToNative; - uint8_t *mapToUChars = u8b->mapToUChars; -- int32_t toUCharsMapStart = ix - (UTF8_TEXT_CHUNK_SIZE*3 + 1); -+ int32_t toUCharsMapStart = ix - sizeof(UTF8Buf::mapToUChars) + 1; -+ // Note that toUCharsMapStart can be negative. Happens when the remaining -+ // text from current position to the beginning is less than the buffer size. -+ // + 1 because mapToUChars must have a slot at the end for the bufNativeLimit entry. - int32_t destIx = UTF8_TEXT_CHUNK_SIZE+2; // Start in the overflow region - // at end of buffer to leave room -@@ -1339,4 +1353,5 @@ - // Special case ASCII range for speed. - buf[destIx] = (UChar)c; -+ U_ASSERT(toUCharsMapStart <= srcIx); - mapToUChars[srcIx - toUCharsMapStart] = (uint8_t)destIx; - mapToNative[destIx] = (uint8_t)(srcIx - toUCharsMapStart); -@@ -1368,4 +1383,5 @@ - mapToUChars[sIx-- - toUCharsMapStart] = (uint8_t)destIx; - } while (sIx >= srcIx); -+ U_ASSERT(toUCharsMapStart <= (srcIx+1)); - - // Set native indexing limit to be the current position. -@@ -1542,4 +1558,5 @@ - U_ASSERT(index<=ut->chunkNativeLimit); - int32_t mapIndex = index - u8b->toUCharsMapStart; -+ U_ASSERT(mapIndex < (int32_t)sizeof(UTF8Buf::mapToUChars)); - int32_t offset = u8b->mapToUChars[mapIndex] - u8b->bufStartIdx; - U_ASSERT(offset>=0 && offset<=ut->chunkLength); -Index: icu/source/test/intltest/utxttest.cpp -=================================================================== ---- icu/source/test/intltest/utxttest.cpp (revision 39670) -+++ icu/source/test/intltest/utxttest.cpp (revision 39671) -@@ -68,4 +68,6 @@ - case 7: name = "Ticket12130"; - if (exec) Ticket12130(); break; -+ case 8: name = "Ticket12888"; -+ if (exec) Ticket12888(); break; - default: name = ""; break; - } -@@ -1584,2 +1586,62 @@ - utext_close(&ut); - } -+ -+// Ticket 12888: bad handling of illegal utf-8 containing many instances of the archaic, now illegal, -+// six byte utf-8 forms. Original implementation had an assumption that -+// there would be at most three utf-8 bytes per UTF-16 code unit. -+// The five and six byte sequences map to a single replacement character. -+ -+void UTextTest::Ticket12888() { -+ const char *badString = -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"; -+ -+ UErrorCode status = U_ZERO_ERROR; -+ LocalUTextPointer ut(utext_openUTF8(NULL, badString, -1, &status)); -+ TEST_SUCCESS(status); -+ for (;;) { -+ UChar32 c = utext_next32(ut.getAlias()); -+ if (c == U_SENTINEL) { -+ break; -+ } -+ } -+ int32_t endIdx = utext_getNativeIndex(ut.getAlias()); -+ if (endIdx != (int32_t)strlen(badString)) { -+ errln("%s:%d expected=%d, actual=%d", __FILE__, __LINE__, strlen(badString), endIdx); -+ return; -+ } -+ -+ for (int32_t prevIndex = endIdx; prevIndex>0;) { -+ UChar32 c = utext_previous32(ut.getAlias()); -+ int32_t currentIndex = utext_getNativeIndex(ut.getAlias()); -+ if (c != 0xfffd) { -+ errln("%s:%d (expected, actual, index) = (%d, %d, %d)\n", -+ __FILE__, __LINE__, 0xfffd, c, currentIndex); -+ break; -+ } -+ if (currentIndex != prevIndex - 6) { -+ errln("%s:%d: wrong index. Expected, actual = %d, %d", -+ __FILE__, __LINE__, prevIndex - 6, currentIndex); -+ break; -+ } -+ prevIndex = currentIndex; -+ } -+} -Index: icu/source/test/intltest/utxttest.h -=================================================================== ---- icu/source/test/intltest/utxttest.h (revision 39670) -+++ icu/source/test/intltest/utxttest.h (revision 39671) -@@ -39,4 +39,5 @@ - void Ticket10983(); - void Ticket12130(); -+ void Ticket12888(); - - private: diff --git a/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch b/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch deleted file mode 100644 index 17970aa4a8..0000000000 --- a/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch +++ /dev/null @@ -1,130 +0,0 @@ -Copied from upstream: http://bugs.icu-project.org/trac/changeset/39484/. - -Fixes <http://bugs.gnu.org/26462> (crashes). - -Paths and line endings have been adapted. - -Index: icu/source/common/ulist.c -=================================================================== ---- icu/source/common/ulist.c (revision 39483) -+++ icu/source/common/ulist.c (revision 39484) -@@ -30,5 +30,4 @@ - - int32_t size; -- int32_t currentIndex; - }; - -@@ -52,5 +51,4 @@ - newList->tail = NULL; - newList->size = 0; -- newList->currentIndex = -1; - - return newList; -@@ -81,6 +79,7 @@ - p->next->previous = p->previous; - } -- list->curr = NULL; -- list->currentIndex = 0; -+ if (p == list->curr) { -+ list->curr = p->next; -+ } - --list->size; - if (p->forceDelete) { -@@ -151,5 +150,4 @@ - list->head->previous = newItem; - list->head = newItem; -- list->currentIndex++; - } - -@@ -194,5 +192,4 @@ - curr = list->curr; - list->curr = curr->next; -- list->currentIndex++; - - return curr->data; -@@ -210,5 +207,4 @@ - if (list != NULL) { - list->curr = list->head; -- list->currentIndex = 0; - } - } -@@ -273,3 +269,2 @@ - return (UList *)(en->context); - } -- -Index: icu/source/i18n/ucol_res.cpp -=================================================================== ---- icu/source/i18n/ucol_res.cpp (revision 39483) -+++ icu/source/i18n/ucol_res.cpp (revision 39484) -@@ -681,4 +681,5 @@ - } - memcpy(en, &defaultKeywordValues, sizeof(UEnumeration)); -+ ulist_resetList(sink.values); // Initialize the iterator. - en->context = sink.values; - sink.values = NULL; // Avoid deletion in the sink destructor. -Index: icu/source/test/intltest/apicoll.cpp -=================================================================== ---- icu/source/test/intltest/apicoll.cpp (revision 39483) -+++ icu/source/test/intltest/apicoll.cpp (revision 39484) -@@ -82,14 +82,7 @@ - col = Collator::createInstance(Locale::getEnglish(), success); - if (U_FAILURE(success)){ -- errcheckln(success, "Default Collator creation failed. - %s", u_errorName(success)); -- return; -- } -- -- StringEnumeration* kwEnum = col->getKeywordValuesForLocale("", Locale::getEnglish(),true,success); -- if (U_FAILURE(success)){ -- errcheckln(success, "Get Keyword Values for Locale failed. - %s", u_errorName(success)); -- return; -- } -- delete kwEnum; -+ errcheckln(success, "English Collator creation failed. - %s", u_errorName(success)); -+ return; -+ } - - col->getVersion(versionArray); -@@ -230,4 +223,27 @@ - delete aFrCol; - delete junk; -+} -+ -+void CollationAPITest::TestKeywordValues() { -+ IcuTestErrorCode errorCode(*this, "TestKeywordValues"); -+ LocalPointer<Collator> col(Collator::createInstance(Locale::getEnglish(), errorCode)); -+ if (errorCode.logIfFailureAndReset("English Collator creation failed")) { -+ return; -+ } -+ -+ LocalPointer<StringEnumeration> kwEnum( -+ col->getKeywordValuesForLocale("collation", Locale::getEnglish(), TRUE, errorCode)); -+ if (errorCode.logIfFailureAndReset("Get Keyword Values for English Collator failed")) { -+ return; -+ } -+ assertTrue("expect at least one collation tailoring for English", kwEnum->count(errorCode) > 0); -+ const char *kw; -+ UBool hasStandard = FALSE; -+ while ((kw = kwEnum->next(NULL, errorCode)) != NULL) { -+ if (strcmp(kw, "standard") == 0) { -+ hasStandard = TRUE; -+ } -+ } -+ assertTrue("expect at least the 'standard' collation tailoring for English", hasStandard); - } - -@@ -2467,4 +2483,5 @@ - TESTCASE_AUTO_BEGIN; - TESTCASE_AUTO(TestProperty); -+ TESTCASE_AUTO(TestKeywordValues); - TESTCASE_AUTO(TestOperators); - TESTCASE_AUTO(TestDuplicate); -Index: icu/source/test/intltest/apicoll.h -=================================================================== ---- icu/source/test/intltest/apicoll.h (revision 39483) -+++ icu/source/test/intltest/apicoll.h (revision 39484) -@@ -36,4 +36,5 @@ - */ - void TestProperty(/* char* par */); -+ void TestKeywordValues(); - - /** diff --git a/gnu/packages/patches/jbig2dec-CVE-2016-9601.patch b/gnu/packages/patches/jbig2dec-CVE-2016-9601.patch deleted file mode 100644 index f45209068f..0000000000 --- a/gnu/packages/patches/jbig2dec-CVE-2016-9601.patch +++ /dev/null @@ -1,906 +0,0 @@ -Fix CVE-2016-9601: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-9601 -https://bugs.ghostscript.com/show_bug.cgi?id=697457 - -Patch copied from upstream source repository: - -http://git.ghostscript.com/?p=jbig2dec.git;a=commitdiff;h=e698d5c11d27212aa1098bc5b1673a3378563092 - -From e698d5c11d27212aa1098bc5b1673a3378563092 Mon Sep 17 00:00:00 2001 -From: Robin Watts <robin.watts@artifex.com> -Date: Mon, 12 Dec 2016 17:47:17 +0000 -Subject: [PATCH] Squash signed/unsigned warnings in MSVC jbig2 build. - -Also rename "new" to "new_dict", because "new" is a bad -variable name. ---- - jbig2.c | 4 +-- - jbig2.h | 8 +++--- - jbig2_generic.c | 2 +- - jbig2_halftone.c | 24 ++++++++---------- - jbig2_huffman.c | 10 ++++---- - jbig2_huffman.h | 2 +- - jbig2_image.c | 32 +++++++++++------------ - jbig2_mmr.c | 66 +++++++++++++++++++++++++----------------------- - jbig2_page.c | 6 ++--- - jbig2_priv.h | 4 +-- - jbig2_segment.c | 10 ++++---- - jbig2_symbol_dict.c | 73 +++++++++++++++++++++++++++-------------------------- - jbig2_symbol_dict.h | 6 ++--- - jbig2_text.c | 16 ++++++------ - jbig2_text.h | 2 +- - 15 files changed, 134 insertions(+), 131 deletions(-) - -diff --git a/jbig2.c b/jbig2.c -index f729e29..e51380f 100644 ---- a/jbig2.c -+++ b/jbig2.c -@@ -379,7 +379,7 @@ typedef struct { - } Jbig2WordStreamBuf; - - static int --jbig2_word_stream_buf_get_next_word(Jbig2WordStream *self, int offset, uint32_t *word) -+jbig2_word_stream_buf_get_next_word(Jbig2WordStream *self, size_t offset, uint32_t *word) - { - Jbig2WordStreamBuf *z = (Jbig2WordStreamBuf *) self; - const byte *data = z->data; -@@ -390,7 +390,7 @@ jbig2_word_stream_buf_get_next_word(Jbig2WordStream *self, int offset, uint32_t - else if (offset > z->size) - return -1; - else { -- int i; -+ size_t i; - - result = 0; - for (i = 0; i < z->size - offset; i++) -diff --git a/jbig2.h b/jbig2.h -index d5aa52f..624e0ed 100644 ---- a/jbig2.h -+++ b/jbig2.h -@@ -56,17 +56,19 @@ typedef struct _Jbig2SymbolDictionary Jbig2SymbolDictionary; - */ - - struct _Jbig2Image { -- int width, height, stride; -+ uint32_t width; -+ uint32_t height; -+ uint32_t stride; - uint8_t *data; - int refcount; - }; - --Jbig2Image *jbig2_image_new(Jbig2Ctx *ctx, int width, int height); -+Jbig2Image *jbig2_image_new(Jbig2Ctx *ctx, uint32_t width, uint32_t height); - Jbig2Image *jbig2_image_clone(Jbig2Ctx *ctx, Jbig2Image *image); - void jbig2_image_release(Jbig2Ctx *ctx, Jbig2Image *image); - void jbig2_image_free(Jbig2Ctx *ctx, Jbig2Image *image); - void jbig2_image_clear(Jbig2Ctx *ctx, Jbig2Image *image, int value); --Jbig2Image *jbig2_image_resize(Jbig2Ctx *ctx, Jbig2Image *image, int width, int height); -+Jbig2Image *jbig2_image_resize(Jbig2Ctx *ctx, Jbig2Image *image, uint32_t width, uint32_t height); - - /* errors are returned from the library via a callback. If no callback - is provided (a NULL argument is passed ot jbig2_ctx_new) a default -diff --git a/jbig2_generic.c b/jbig2_generic.c -index 02fdbfb..9656198 100644 ---- a/jbig2_generic.c -+++ b/jbig2_generic.c -@@ -718,7 +718,7 @@ jbig2_immediate_generic_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte - byte seg_flags; - int8_t gbat[8]; - int offset; -- int gbat_bytes = 0; -+ uint32_t gbat_bytes = 0; - Jbig2GenericRegionParams params; - int code = 0; - Jbig2Image *image = NULL; -diff --git a/jbig2_halftone.c b/jbig2_halftone.c -index aeab576..acfbc56 100644 ---- a/jbig2_halftone.c -+++ b/jbig2_halftone.c -@@ -257,8 +257,8 @@ jbig2_decode_gray_scale_image(Jbig2Ctx *ctx, Jbig2Segment *segment, - { - uint8_t **GSVALS = NULL; - size_t consumed_bytes = 0; -- int i, j, code, stride; -- int x, y; -+ uint32_t i, j, stride, x, y; -+ int code; - Jbig2Image **GSPLANES; - Jbig2GenericRegionParams rparams; - Jbig2WordStream *ws = NULL; -@@ -276,9 +276,8 @@ jbig2_decode_gray_scale_image(Jbig2Ctx *ctx, Jbig2Segment *segment, - if (GSPLANES[i] == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate %dx%d image for GSPLANES", GSW, GSH); - /* free already allocated */ -- for (j = i - 1; j >= 0; --j) { -- jbig2_image_release(ctx, GSPLANES[j]); -- } -+ for (j = i; j > 0;) -+ jbig2_image_release(ctx, GSPLANES[--j]); - jbig2_free(ctx->allocator, GSPLANES); - return NULL; - } -@@ -323,9 +322,10 @@ jbig2_decode_gray_scale_image(Jbig2Ctx *ctx, Jbig2Segment *segment, - } - - /* C.5 step 2. Set j = GSBPP-2 */ -- j = GSBPP - 2; -+ j = GSBPP - 1; - /* C.5 step 3. decode loop */ -- while (j >= 0) { -+ while (j > 0) { -+ j--; - /* C.5 step 3. (a) */ - if (GSMMR) { - code = jbig2_decode_halftone_mmr(ctx, &rparams, data + consumed_bytes, size - consumed_bytes, GSPLANES[j], &consumed_bytes); -@@ -345,7 +345,6 @@ jbig2_decode_gray_scale_image(Jbig2Ctx *ctx, Jbig2Segment *segment, - GSPLANES[j]->data[i] ^= GSPLANES[j + 1]->data[i]; - - /* C.5 step 3. (c) */ -- --j; - } - - /* allocate GSVALS */ -@@ -359,9 +358,8 @@ jbig2_decode_gray_scale_image(Jbig2Ctx *ctx, Jbig2Segment *segment, - if (GSVALS[i] == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate GSVALS: %d bytes", GSH * GSW); - /* free already allocated */ -- for (j = i - 1; j >= 0; --j) { -- jbig2_free(ctx->allocator, GSVALS[j]); -- } -+ for (j = i; j > 0;) -+ jbig2_free(ctx->allocator, GSVALS[--j]); - jbig2_free(ctx->allocator, GSVALS); - GSVALS = NULL; - goto cleanup; -@@ -450,7 +448,7 @@ jbig2_decode_halftone_region(Jbig2Ctx *ctx, Jbig2Segment *segment, - uint8_t **GI; - Jbig2Image *HSKIP = NULL; - Jbig2PatternDict *HPATS; -- int i; -+ uint32_t i; - uint32_t mg, ng; - int32_t x, y; - uint8_t gray_val; -@@ -476,7 +474,7 @@ jbig2_decode_halftone_region(Jbig2Ctx *ctx, Jbig2Segment *segment, - - /* calculate ceil(log2(HNUMPATS)) */ - HBPP = 0; -- while (HNUMPATS > (1 << ++HBPP)); -+ while (HNUMPATS > (1U << ++HBPP)); - - /* 6.6.5 point 4. decode gray-scale image as mentioned in annex C */ - GI = jbig2_decode_gray_scale_image(ctx, segment, data, size, -diff --git a/jbig2_huffman.c b/jbig2_huffman.c -index 4521b48..f77981b 100644 ---- a/jbig2_huffman.c -+++ b/jbig2_huffman.c -@@ -47,16 +47,16 @@ struct _Jbig2HuffmanState { - is (offset + 4) * 8. */ - uint32_t this_word; - uint32_t next_word; -- int offset_bits; -- int offset; -- int offset_limit; -+ uint32_t offset_bits; -+ uint32_t offset; -+ uint32_t offset_limit; - - Jbig2WordStream *ws; - Jbig2Ctx *ctx; - }; - - static uint32_t --huff_get_next_word(Jbig2HuffmanState *hs, int offset) -+huff_get_next_word(Jbig2HuffmanState *hs, uint32_t offset) - { - uint32_t word = 0; - Jbig2WordStream *ws = hs->ws; -@@ -213,7 +213,7 @@ jbig2_huffman_advance(Jbig2HuffmanState *hs, int offset) - /* return the offset of the huffman decode pointer (in bytes) - * from the beginning of the WordStream - */ --int -+uint32_t - jbig2_huffman_offset(Jbig2HuffmanState *hs) - { - return hs->offset + (hs->offset_bits >> 3); -diff --git a/jbig2_huffman.h b/jbig2_huffman.h -index 5d1e6e0..cfda9e0 100644 ---- a/jbig2_huffman.h -+++ b/jbig2_huffman.h -@@ -64,7 +64,7 @@ void jbig2_huffman_skip(Jbig2HuffmanState *hs); - - void jbig2_huffman_advance(Jbig2HuffmanState *hs, int offset); - --int jbig2_huffman_offset(Jbig2HuffmanState *hs); -+uint32_t jbig2_huffman_offset(Jbig2HuffmanState *hs); - - int32_t jbig2_huffman_get(Jbig2HuffmanState *hs, const Jbig2HuffmanTable *table, bool *oob); - -diff --git a/jbig2_image.c b/jbig2_image.c -index 1ae614e..94e5a4c 100644 ---- a/jbig2_image.c -+++ b/jbig2_image.c -@@ -32,10 +32,10 @@ - - /* allocate a Jbig2Image structure and its associated bitmap */ - Jbig2Image * --jbig2_image_new(Jbig2Ctx *ctx, int width, int height) -+jbig2_image_new(Jbig2Ctx *ctx, uint32_t width, uint32_t height) - { - Jbig2Image *image; -- int stride; -+ uint32_t stride; - int64_t check; - - image = jbig2_new(ctx, Jbig2Image, 1); -@@ -99,7 +99,7 @@ jbig2_image_free(Jbig2Ctx *ctx, Jbig2Image *image) - - /* resize a Jbig2Image */ - Jbig2Image * --jbig2_image_resize(Jbig2Ctx *ctx, Jbig2Image *image, int width, int height) -+jbig2_image_resize(Jbig2Ctx *ctx, Jbig2Image *image, uint32_t width, uint32_t height) - { - if (width == image->width) { - /* check for integer multiplication overflow */ -@@ -133,11 +133,11 @@ jbig2_image_resize(Jbig2Ctx *ctx, Jbig2Image *image, int width, int height) - static int - jbig2_image_compose_unopt(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int y, Jbig2ComposeOp op) - { -- int i, j; -- int sw = src->width; -- int sh = src->height; -- int sx = 0; -- int sy = 0; -+ uint32_t i, j; -+ uint32_t sw = src->width; -+ uint32_t sh = src->height; -+ uint32_t sx = 0; -+ uint32_t sy = 0; - - /* clip to the dst image boundaries */ - if (x < 0) { -@@ -200,10 +200,10 @@ jbig2_image_compose_unopt(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x - int - jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int y, Jbig2ComposeOp op) - { -- int i, j; -- int w, h; -- int leftbyte, rightbyte; -- int shift; -+ uint32_t i, j; -+ uint32_t w, h; -+ uint32_t leftbyte, rightbyte; -+ uint32_t shift; - uint8_t *s, *ss; - uint8_t *d, *dd; - uint8_t mask, rightmask; -@@ -226,8 +226,8 @@ jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int - h += y; - y = 0; - } -- w = (x + w < dst->width) ? w : dst->width - x; -- h = (y + h < dst->height) ? h : dst->height - y; -+ w = ((uint32_t)x + w < dst->width) ? w : ((dst->width >= (uint32_t)x) ? dst->width - (uint32_t)x : 0); -+ h = ((uint32_t)y + h < dst->height) ? h : ((dst->height >= (uint32_t)y) ? dst->height - (uint32_t)y : 0); - #ifdef JBIG2_DEBUG - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, "compositing %dx%d at (%d, %d) after clipping\n", w, h, x, y); - #endif -@@ -249,8 +249,8 @@ jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int - } - #endif - -- leftbyte = x >> 3; -- rightbyte = (x + w - 1) >> 3; -+ leftbyte = (uint32_t)x >> 3; -+ rightbyte = ((uint32_t)x + w - 1) >> 3; - shift = x & 7; - - /* general OR case */ -diff --git a/jbig2_mmr.c b/jbig2_mmr.c -index d4cd3a2..390e27c 100644 ---- a/jbig2_mmr.c -+++ b/jbig2_mmr.c -@@ -38,19 +38,21 @@ - #include "jbig2_mmr.h" - - typedef struct { -- int width; -- int height; -+ uint32_t width; -+ uint32_t height; - const byte *data; - size_t size; -- int data_index; -- int bit_index; -+ uint32_t data_index; -+ uint32_t bit_index; - uint32_t word; - } Jbig2MmrCtx; - -+#define MINUS1 ((uint32_t)-1) -+ - static void - jbig2_decode_mmr_init(Jbig2MmrCtx *mmr, int width, int height, const byte *data, size_t size) - { -- int i; -+ size_t i; - uint32_t word = 0; - - mmr->width = width; -@@ -732,14 +734,14 @@ const mmr_table_node jbig2_mmr_black_decode[] = { - #define getbit(buf, x) ( ( buf[x >> 3] >> ( 7 - (x & 7) ) ) & 1 ) - - static int --jbig2_find_changing_element(const byte *line, int x, int w) -+jbig2_find_changing_element(const byte *line, uint32_t x, uint32_t w) - { - int a, b; - - if (line == 0) -- return w; -+ return (int)w; - -- if (x == -1) { -+ if (x == MINUS1) { - a = 0; - x = 0; - } else { -@@ -758,7 +760,7 @@ jbig2_find_changing_element(const byte *line, int x, int w) - } - - static int --jbig2_find_changing_element_of_color(const byte *line, int x, int w, int color) -+jbig2_find_changing_element_of_color(const byte *line, uint32_t x, uint32_t w, int color) - { - if (line == 0) - return w; -@@ -772,9 +774,9 @@ static const byte lm[8] = { 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01 }; - static const byte rm[8] = { 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE }; - - static void --jbig2_set_bits(byte *line, int x0, int x1) -+jbig2_set_bits(byte *line, uint32_t x0, uint32_t x1) - { -- int a0, a1, b0, b1, a; -+ uint32_t a0, a1, b0, b1, a; - - a0 = x0 >> 3; - a1 = x1 >> 3; -@@ -831,8 +833,8 @@ jbig2_decode_get_run(Jbig2MmrCtx *mmr, const mmr_table_node *table, int initial_ - static int - jbig2_decode_mmr_line(Jbig2MmrCtx *mmr, const byte *ref, byte *dst) - { -- int a0 = -1; -- int a1, a2, b1, b2; -+ uint32_t a0 = MINUS1; -+ uint32_t a1, a2, b1, b2; - int c = 0; /* 0 is white, black is 1 */ - - while (1) { -@@ -840,7 +842,7 @@ jbig2_decode_mmr_line(Jbig2MmrCtx *mmr, const byte *ref, byte *dst) - - /* printf ("%08x\n", word); */ - -- if (a0 >= mmr->width) -+ if (a0 != MINUS1 && a0 >= mmr->width) - break; - - if ((word >> (32 - 3)) == 1) { -@@ -848,7 +850,7 @@ jbig2_decode_mmr_line(Jbig2MmrCtx *mmr, const byte *ref, byte *dst) - - jbig2_decode_mmr_consume(mmr, 3); - -- if (a0 == -1) -+ if (a0 == MINUS1) - a0 = 0; - - if (c == 0) { -@@ -860,7 +862,7 @@ jbig2_decode_mmr_line(Jbig2MmrCtx *mmr, const byte *ref, byte *dst) - a1 = mmr->width; - if (a2 > mmr->width) - a2 = mmr->width; -- if (a2 < a1 || a1 < 0) -+ if (a1 == MINUS1 || a2 < a1) - return -1; - jbig2_set_bits(dst, a1, a2); - a0 = a2; -@@ -874,7 +876,7 @@ jbig2_decode_mmr_line(Jbig2MmrCtx *mmr, const byte *ref, byte *dst) - a1 = mmr->width; - if (a2 > mmr->width) - a2 = mmr->width; -- if (a1 < a0 || a0 < 0) -+ if (a0 == MINUS1 || a1 < a0) - return -1; - jbig2_set_bits(dst, a0, a1); - a0 = a2; -@@ -888,7 +890,7 @@ jbig2_decode_mmr_line(Jbig2MmrCtx *mmr, const byte *ref, byte *dst) - b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c); - b2 = jbig2_find_changing_element(ref, b1, mmr->width); - if (c) { -- if (b2 < a0 || a0 < 0) -+ if (a0 == MINUS1 || b2 < a0) - return -1; - jbig2_set_bits(dst, a0, b2); - } -@@ -900,7 +902,7 @@ jbig2_decode_mmr_line(Jbig2MmrCtx *mmr, const byte *ref, byte *dst) - jbig2_decode_mmr_consume(mmr, 1); - b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c); - if (c) { -- if (b1 < a0 || a0 < 0) -+ if (a0 == MINUS1 || b1 < a0) - return -1; - jbig2_set_bits(dst, a0, b1); - } -@@ -915,7 +917,7 @@ jbig2_decode_mmr_line(Jbig2MmrCtx *mmr, const byte *ref, byte *dst) - if (b1 + 1 > mmr->width) - break; - if (c) { -- if (b1 + 1 < a0 || a0 < 0) -+ if (a0 == MINUS1 || b1 + 1 < a0) - return -1; - jbig2_set_bits(dst, a0, b1 + 1); - } -@@ -930,7 +932,7 @@ jbig2_decode_mmr_line(Jbig2MmrCtx *mmr, const byte *ref, byte *dst) - if (b1 + 2 > mmr->width) - break; - if (c) { -- if (b1 + 2 < a0 || a0 < 0) -+ if (a0 == MINUS1 || b1 + 2 < a0) - return -1; - jbig2_set_bits(dst, a0, b1 + 2); - } -@@ -942,10 +944,10 @@ jbig2_decode_mmr_line(Jbig2MmrCtx *mmr, const byte *ref, byte *dst) - /* printf ("VR(3)\n"); */ - jbig2_decode_mmr_consume(mmr, 7); - b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c); -- if (b1 + 3 > mmr->width) -+ if (b1 + 3 > (int)mmr->width) - break; - if (c) { -- if (b1 + 3 < a0 || a0 < 0) -+ if (a0 == MINUS1 || b1 + 3 < a0) - return -1; - jbig2_set_bits(dst, a0, b1 + 3); - } -@@ -957,10 +959,10 @@ jbig2_decode_mmr_line(Jbig2MmrCtx *mmr, const byte *ref, byte *dst) - /* printf ("VL(1)\n"); */ - jbig2_decode_mmr_consume(mmr, 3); - b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c); -- if (b1 - 1 < 0) -+ if (b1 < 1) - break; - if (c) { -- if (b1 - 1 < a0 || a0 < 0) -+ if (a0 == MINUS1 || b1 - 1 < a0) - return -1; - jbig2_set_bits(dst, a0, b1 - 1); - } -@@ -972,7 +974,7 @@ jbig2_decode_mmr_line(Jbig2MmrCtx *mmr, const byte *ref, byte *dst) - /* printf ("VL(2)\n"); */ - jbig2_decode_mmr_consume(mmr, 6); - b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c); -- if (b1 - 2 < 0) -+ if (b1 < 2) - break; - if (c) { - if (b1 - 2 < a0 || a0 < 0) -@@ -987,10 +989,10 @@ jbig2_decode_mmr_line(Jbig2MmrCtx *mmr, const byte *ref, byte *dst) - /* printf ("VL(3)\n"); */ - jbig2_decode_mmr_consume(mmr, 7); - b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c); -- if (b1 - 3 < 0) -+ if (b1 < 3) - break; - if (c) { -- if (b1 - 3 < a0 || a0 < 0) -+ if (a0 == MINUS1 || b1 - 3 < a0) - return -1; - jbig2_set_bits(dst, a0, b1 - 3); - } -@@ -1009,10 +1011,10 @@ int - jbig2_decode_generic_mmr(Jbig2Ctx *ctx, Jbig2Segment *segment, const Jbig2GenericRegionParams *params, const byte *data, size_t size, Jbig2Image *image) - { - Jbig2MmrCtx mmr; -- const int rowstride = image->stride; -+ const uint32_t rowstride = image->stride; - byte *dst = image->data; - byte *ref = NULL; -- int y; -+ uint32_t y; - int code = 0; - - jbig2_decode_mmr_init(&mmr, image->width, image->height, data, size); -@@ -1047,10 +1049,10 @@ int - jbig2_decode_halftone_mmr(Jbig2Ctx *ctx, const Jbig2GenericRegionParams *params, const byte *data, size_t size, Jbig2Image *image, size_t *consumed_bytes) - { - Jbig2MmrCtx mmr; -- const int rowstride = image->stride; -+ const uint32_t rowstride = image->stride; - byte *dst = image->data; - byte *ref = NULL; -- int y; -+ uint32_t y; - int code = 0; - const uint32_t EOFB = 0x001001; - -diff --git a/jbig2_page.c b/jbig2_page.c -index 110ff7c..1ed1c8a 100644 ---- a/jbig2_page.c -+++ b/jbig2_page.c -@@ -155,9 +155,9 @@ int - jbig2_end_of_stripe(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data) - { - Jbig2Page page = ctx->pages[ctx->current_page]; -- int end_row; -+ uint32_t end_row; - -- end_row = jbig2_get_int32(segment_data); -+ end_row = jbig2_get_uint32(segment_data); - if (end_row < page.end_row) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, - "end of stripe segment with non-positive end row advance" " (new end row %d vs current end row %d)", end_row, page.end_row); -@@ -248,7 +248,7 @@ jbig2_page_add_result(Jbig2Ctx *ctx, Jbig2Page *page, Jbig2Image *image, int x, - - /* grow the page to accomodate a new stripe if necessary */ - if (page->striped) { -- int new_height = y + image->height + page->end_row; -+ uint32_t new_height = y + image->height + page->end_row; - - if (page->image->height < new_height) { - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, "growing page buffer to %d rows " "to accomodate new stripe", new_height); -diff --git a/jbig2_priv.h b/jbig2_priv.h -index 42ba496..3d44b42 100644 ---- a/jbig2_priv.h -+++ b/jbig2_priv.h -@@ -132,7 +132,7 @@ struct _Jbig2Page { - uint32_t x_resolution, y_resolution; /* in pixels per meter */ - uint16_t stripe_size; - bool striped; -- int end_row; -+ uint32_t end_row; - uint8_t flags; - Jbig2Image *image; - }; -@@ -182,7 +182,7 @@ int jbig2_halftone_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segm - typedef struct _Jbig2WordStream Jbig2WordStream; - - struct _Jbig2WordStream { -- int (*get_next_word)(Jbig2WordStream *self, int offset, uint32_t *word); -+ int (*get_next_word)(Jbig2WordStream *self, size_t offset, uint32_t *word); - }; - - Jbig2WordStream *jbig2_word_stream_buf_new(Jbig2Ctx *ctx, const byte *data, size_t size); -diff --git a/jbig2_segment.c b/jbig2_segment.c -index 2e0db67..5b63706 100644 ---- a/jbig2_segment.c -+++ b/jbig2_segment.c -@@ -39,10 +39,10 @@ jbig2_parse_segment_header(Jbig2Ctx *ctx, uint8_t *buf, size_t buf_size, size_t - uint8_t rtscarf; - uint32_t rtscarf_long; - uint32_t *referred_to_segments; -- int referred_to_segment_count; -- int referred_to_segment_size; -- int pa_size; -- int offset; -+ uint32_t referred_to_segment_count; -+ uint32_t referred_to_segment_size; -+ uint32_t pa_size; -+ uint32_t offset; - - /* minimum possible size of a jbig2 segment header */ - if (buf_size < 11) -@@ -83,7 +83,7 @@ jbig2_parse_segment_header(Jbig2Ctx *ctx, uint8_t *buf, size_t buf_size, size_t - - /* 7.2.5 */ - if (referred_to_segment_count) { -- int i; -+ uint32_t i; - - referred_to_segments = jbig2_new(ctx, uint32_t, referred_to_segment_count * referred_to_segment_size); - if (referred_to_segments == NULL) { -diff --git a/jbig2_symbol_dict.c b/jbig2_symbol_dict.c -index 2c71a4c..11a2252 100644 ---- a/jbig2_symbol_dict.c -+++ b/jbig2_symbol_dict.c -@@ -88,40 +88,40 @@ jbig2_dump_symbol_dict(Jbig2Ctx *ctx, Jbig2Segment *segment) - - /* return a new empty symbol dict */ - Jbig2SymbolDict * --jbig2_sd_new(Jbig2Ctx *ctx, int n_symbols) -+jbig2_sd_new(Jbig2Ctx *ctx, uint32_t n_symbols) - { -- Jbig2SymbolDict *new = NULL; -+ Jbig2SymbolDict *new_dict = NULL; - - if (n_symbols < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "Negative number of symbols in symbol dict: %d", n_symbols); - return NULL; - } - -- new = jbig2_new(ctx, Jbig2SymbolDict, 1); -- if (new != NULL) { -- new->glyphs = jbig2_new(ctx, Jbig2Image *, n_symbols); -- new->n_symbols = n_symbols; -+ new_dict = jbig2_new(ctx, Jbig2SymbolDict, 1); -+ if (new_dict != NULL) { -+ new_dict->glyphs = jbig2_new(ctx, Jbig2Image *, n_symbols); -+ new_dict->n_symbols = n_symbols; - } else { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "unable to allocate new empty symbol dict"); - return NULL; - } - -- if (new->glyphs != NULL) { -- memset(new->glyphs, 0, n_symbols * sizeof(Jbig2Image *)); -+ if (new_dict->glyphs != NULL) { -+ memset(new_dict->glyphs, 0, n_symbols * sizeof(Jbig2Image *)); - } else { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "unable to allocate glyphs for new empty symbol dict"); -- jbig2_free(ctx->allocator, new); -+ jbig2_free(ctx->allocator, new_dict); - return NULL; - } - -- return new; -+ return new_dict; - } - - /* release the memory associated with a symbol dict */ - void - jbig2_sd_release(Jbig2Ctx *ctx, Jbig2SymbolDict *dict) - { -- int i; -+ uint32_t i; - - if (dict == NULL) - return; -@@ -142,12 +142,12 @@ jbig2_sd_glyph(Jbig2SymbolDict *dict, unsigned int id) - } - - /* count the number of dictionary segments referred to by the given segment */ --int -+uint32_t - jbig2_sd_count_referred(Jbig2Ctx *ctx, Jbig2Segment *segment) - { - int index; - Jbig2Segment *rsegment; -- int n_dicts = 0; -+ uint32_t n_dicts = 0; - - for (index = 0; index < segment->referred_to_segment_count; index++) { - rsegment = jbig2_find_segment(ctx, segment->referred_to_segments[index]); -@@ -166,8 +166,8 @@ jbig2_sd_list_referred(Jbig2Ctx *ctx, Jbig2Segment *segment) - int index; - Jbig2Segment *rsegment; - Jbig2SymbolDict **dicts; -- int n_dicts = jbig2_sd_count_referred(ctx, segment); -- int dindex = 0; -+ uint32_t n_dicts = jbig2_sd_count_referred(ctx, segment); -+ uint32_t dindex = 0; - - dicts = jbig2_new(ctx, Jbig2SymbolDict *, n_dicts); - if (dicts == NULL) { -@@ -195,10 +195,10 @@ jbig2_sd_list_referred(Jbig2Ctx *ctx, Jbig2Segment *segment) - /* generate a new symbol dictionary by concatenating a list of - existing dictionaries */ - Jbig2SymbolDict * --jbig2_sd_cat(Jbig2Ctx *ctx, int n_dicts, Jbig2SymbolDict **dicts) -+jbig2_sd_cat(Jbig2Ctx *ctx, uint32_t n_dicts, Jbig2SymbolDict **dicts) - { -- int i, j, k, symbols; -- Jbig2SymbolDict *new = NULL; -+ uint32_t i, j, k, symbols; -+ Jbig2SymbolDict *new_dict = NULL; - - /* count the imported symbols and allocate a new array */ - symbols = 0; -@@ -206,17 +206,17 @@ jbig2_sd_cat(Jbig2Ctx *ctx, int n_dicts, Jbig2SymbolDict **dicts) - symbols += dicts[i]->n_symbols; - - /* fill a new array with cloned glyph pointers */ -- new = jbig2_sd_new(ctx, symbols); -- if (new != NULL) { -+ new_dict = jbig2_sd_new(ctx, symbols); -+ if (new_dict != NULL) { - k = 0; - for (i = 0; i < n_dicts; i++) - for (j = 0; j < dicts[i]->n_symbols; j++) -- new->glyphs[k++] = jbig2_image_clone(ctx, dicts[i]->glyphs[j]); -+ new_dict->glyphs[k++] = jbig2_image_clone(ctx, dicts[i]->glyphs[j]); - } else { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to allocate new symbol dictionary"); - } - -- return new; -+ return new_dict; - } - - /* Decoding routines */ -@@ -431,7 +431,7 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx, - - if (REFAGGNINST > 1) { - Jbig2Image *image; -- int i; -+ uint32_t i; - - if (tparams == NULL) { - /* First time through, we need to initialise the */ -@@ -512,7 +512,7 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx, - uint32_t ID; - int32_t RDX, RDY; - int BMSIZE = 0; -- int ninsyms = params->SDNUMINSYMS; -+ uint32_t ninsyms = params->SDNUMINSYMS; - int code1 = 0; - int code2 = 0; - int code3 = 0; -@@ -609,8 +609,9 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx, - if (params->SDHUFF && !params->SDREFAGG) { - /* 6.5.9 */ - Jbig2Image *image; -- int BMSIZE = jbig2_huffman_get(hs, params->SDHUFFBMSIZE, &code); -- int j, x; -+ uint32_t BMSIZE = jbig2_huffman_get(hs, params->SDHUFFBMSIZE, &code); -+ uint32_t j; -+ int x; - - if (code || (BMSIZE < 0)) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error decoding size of collective bitmap!"); -@@ -700,22 +701,22 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx, - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate symbols exported from symbols dictionary"); - goto cleanup4; - } else { -- int i = 0; -- int j = 0; -- int k; -+ uint32_t i = 0; -+ uint32_t j = 0; -+ uint32_t k; - int exflag = 0; -- int64_t limit = params->SDNUMINSYMS + params->SDNUMNEWSYMS; -- int32_t exrunlength; -+ uint32_t limit = params->SDNUMINSYMS + params->SDNUMNEWSYMS; -+ uint32_t exrunlength; - int zerolength = 0; - - while (i < limit) { - if (params->SDHUFF) - exrunlength = jbig2_huffman_get(hs, SBHUFFRSIZE, &code); - else -- code = jbig2_arith_int_decode(IAEX, as, &exrunlength); -+ code = jbig2_arith_int_decode(IAEX, as, (int32_t *)&exrunlength); - /* prevent infinite loop */ - zerolength = exrunlength > 0 ? 0 : zerolength + 1; -- if (code || (exrunlength > limit - i) || (exrunlength < 0) || (zerolength > 4) || (exflag && (exrunlength > params->SDNUMEXSYMS - j))) { -+ if (code || (exrunlength > limit - i) || (exrunlength < 0) || (zerolength > 4) || (exflag && (exrunlength + j > params->SDNUMEXSYMS))) { - if (code) - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to decode exrunlength for exported symbols"); - else if (exrunlength <= 0) -@@ -797,8 +798,8 @@ jbig2_symbol_dictionary(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segmen - { - Jbig2SymbolDictParams params; - uint16_t flags; -- int sdat_bytes; -- int offset; -+ uint32_t sdat_bytes; -+ uint32_t offset; - Jbig2ArithCx *GB_stats = NULL; - Jbig2ArithCx *GR_stats = NULL; - int table_index = 0; -@@ -951,7 +952,7 @@ jbig2_symbol_dictionary(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segmen - - /* 7.4.2.2 (2) */ - { -- int n_dicts = jbig2_sd_count_referred(ctx, segment); -+ uint32_t n_dicts = jbig2_sd_count_referred(ctx, segment); - Jbig2SymbolDict **dicts = NULL; - - if (n_dicts > 0) { -diff --git a/jbig2_symbol_dict.h b/jbig2_symbol_dict.h -index d56d62d..30211d4 100644 ---- a/jbig2_symbol_dict.h -+++ b/jbig2_symbol_dict.h -@@ -32,18 +32,18 @@ int jbig2_symbol_dictionary(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *se - Jbig2Image *jbig2_sd_glyph(Jbig2SymbolDict *dict, unsigned int id); - - /* return a new empty symbol dict */ --Jbig2SymbolDict *jbig2_sd_new(Jbig2Ctx *ctx, int n_symbols); -+Jbig2SymbolDict *jbig2_sd_new(Jbig2Ctx *ctx, uint32_t n_symbols); - - /* release the memory associated with a symbol dict */ - void jbig2_sd_release(Jbig2Ctx *ctx, Jbig2SymbolDict *dict); - - /* generate a new symbol dictionary by concatenating a list of - existing dictionaries */ --Jbig2SymbolDict *jbig2_sd_cat(Jbig2Ctx *ctx, int n_dicts, Jbig2SymbolDict **dicts); -+Jbig2SymbolDict *jbig2_sd_cat(Jbig2Ctx *ctx, uint32_t n_dicts, Jbig2SymbolDict **dicts); - - /* count the number of dictionary segments referred - to by the given segment */ --int jbig2_sd_count_referred(Jbig2Ctx *ctx, Jbig2Segment *segment); -+uint32_t jbig2_sd_count_referred(Jbig2Ctx *ctx, Jbig2Segment *segment); - - /* return an array of pointers to symbol dictionaries referred - to by a segment */ -diff --git a/jbig2_text.c b/jbig2_text.c -index 5c99640..e77460f 100644 ---- a/jbig2_text.c -+++ b/jbig2_text.c -@@ -55,7 +55,7 @@ - int - jbig2_decode_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, - const Jbig2TextRegionParams *params, -- const Jbig2SymbolDict *const *dicts, const int n_dicts, -+ const Jbig2SymbolDict *const *dicts, const uint32_t n_dicts, - Jbig2Image *image, const byte *data, const size_t size, Jbig2ArithCx *GR_stats, Jbig2ArithState *as, Jbig2WordStream *ws) - { - /* relevent bits of 6.4.4 */ -@@ -476,19 +476,19 @@ cleanup2: - int - jbig2_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data) - { -- int offset = 0; -+ uint32_t offset = 0; - Jbig2RegionSegmentInfo region_info; - Jbig2TextRegionParams params; - Jbig2Image *image = NULL; - Jbig2SymbolDict **dicts = NULL; -- int n_dicts = 0; -+ uint32_t n_dicts = 0; - uint16_t flags = 0; - uint16_t huffman_flags = 0; - Jbig2ArithCx *GR_stats = NULL; - int code = 0; - Jbig2WordStream *ws = NULL; - Jbig2ArithState *as = NULL; -- int table_index = 0; -+ uint32_t table_index = 0; - const Jbig2HuffmanParams *huffman_params = NULL; - - /* 7.4.1 */ -@@ -779,7 +779,7 @@ jbig2_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "unable to retrive symbol dictionaries! previous parsing error?"); - goto cleanup1; - } else { -- int index; -+ uint32_t index; - - if (dicts[0] == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to find first referenced symbol dictionary!"); -@@ -823,8 +823,8 @@ jbig2_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data - } - - if (!params.SBHUFF) { -- int SBSYMCODELEN, index; -- int SBNUMSYMS = 0; -+ uint32_t SBSYMCODELEN, index; -+ uint32_t SBNUMSYMS = 0; - - for (index = 0; index < n_dicts; index++) { - SBNUMSYMS += dicts[index]->n_symbols; -@@ -840,7 +840,7 @@ jbig2_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data - } - - /* Table 31 */ -- for (SBSYMCODELEN = 0; (1 << SBSYMCODELEN) < SBNUMSYMS; SBSYMCODELEN++) { -+ for (SBSYMCODELEN = 0; (1U << SBSYMCODELEN) < SBNUMSYMS; SBSYMCODELEN++) { - } - params.IAID = jbig2_arith_iaid_ctx_new(ctx, SBSYMCODELEN); - params.IARI = jbig2_arith_int_ctx_new(ctx); -diff --git a/jbig2_text.h b/jbig2_text.h -index aec2732..51d242e 100644 ---- a/jbig2_text.h -+++ b/jbig2_text.h -@@ -70,5 +70,5 @@ typedef struct { - int - jbig2_decode_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, - const Jbig2TextRegionParams *params, -- const Jbig2SymbolDict *const *dicts, const int n_dicts, -+ const Jbig2SymbolDict *const *dicts, const uint32_t n_dicts, - Jbig2Image *image, const byte *data, const size_t size, Jbig2ArithCx *GR_stats, Jbig2ArithState *as, Jbig2WordStream *ws); --- -2.9.1 - diff --git a/gnu/packages/patches/jbig2dec-CVE-2017-7885.patch b/gnu/packages/patches/jbig2dec-CVE-2017-7885.patch deleted file mode 100644 index a598392765..0000000000 --- a/gnu/packages/patches/jbig2dec-CVE-2017-7885.patch +++ /dev/null @@ -1,38 +0,0 @@ -Fix CVE-2017-7885: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7885 -https://bugs.ghostscript.com/show_bug.cgi?id=697703 - -Patch copied from upstream source repository: - -https://git.ghostscript.com/?p=jbig2dec.git;a=commit;h=258290340bb657c9efb44457f717b0d8b49f4aa3 - -From 258290340bb657c9efb44457f717b0d8b49f4aa3 Mon Sep 17 00:00:00 2001 -From: Shailesh Mistry <shailesh.mistry@hotmail.co.uk> -Date: Wed, 3 May 2017 22:06:01 +0100 -Subject: [PATCH] Bug 697703: Prevent integer overflow vulnerability. - -Add extra check for the offset being greater than the size -of the image and hence reading off the end of the buffer. - -Thank you to Dai Ge for finding this issue and suggesting a patch. ---- - jbig2_symbol_dict.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/jbig2_symbol_dict.c b/jbig2_symbol_dict.c -index 4acaba9..36225cb 100644 ---- a/jbig2_symbol_dict.c -+++ b/jbig2_symbol_dict.c -@@ -629,7 +629,7 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx, - byte *dst = image->data; - - /* SumatraPDF: prevent read access violation */ -- if (size - jbig2_huffman_offset(hs) < image->height * stride) { -+ if ((size - jbig2_huffman_offset(hs) < image->height * stride) || (size < jbig2_huffman_offset(hs))) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "not enough data for decoding (%d/%d)", image->height * stride, - size - jbig2_huffman_offset(hs)); - jbig2_image_release(ctx, image); --- -2.13.0 - diff --git a/gnu/packages/patches/jbig2dec-CVE-2017-7975.patch b/gnu/packages/patches/jbig2dec-CVE-2017-7975.patch deleted file mode 100644 index c83fe9d9f2..0000000000 --- a/gnu/packages/patches/jbig2dec-CVE-2017-7975.patch +++ /dev/null @@ -1,40 +0,0 @@ -Fix CVE-2017-7975: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7975 -https://bugs.ghostscript.com/show_bug.cgi?id=697693 - -Patch copied from upstream source repository: - -https://git.ghostscript.com/?p=jbig2dec.git;a=commit;h=f8992b8fe65c170c8624226f127c5c4bfed42c66 - -From f8992b8fe65c170c8624226f127c5c4bfed42c66 Mon Sep 17 00:00:00 2001 -From: Shailesh Mistry <shailesh.mistry@hotmail.co.uk> -Date: Wed, 26 Apr 2017 22:12:14 +0100 -Subject: [PATCH] Bug 697693: Prevent SEGV due to integer overflow. - -While building a Huffman table, the start and end points were susceptible -to integer overflow. - -Thank you to Jiaqi for finding this issue and suggesting a patch. ---- - jbig2_huffman.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/jbig2_huffman.c b/jbig2_huffman.c -index 511e461..b4189a1 100644 ---- a/jbig2_huffman.c -+++ b/jbig2_huffman.c -@@ -421,8 +421,8 @@ jbig2_build_huffman_table(Jbig2Ctx *ctx, const Jbig2HuffmanParams *params) - - if (PREFLEN == CURLEN) { - int RANGELEN = lines[CURTEMP].RANGELEN; -- int start_j = CURCODE << shift; -- int end_j = (CURCODE + 1) << shift; -+ uint32_t start_j = CURCODE << shift; -+ uint32_t end_j = (CURCODE + 1) << shift; - byte eflags = 0; - - if (end_j > max_j) { --- -2.13.0 - diff --git a/gnu/packages/patches/jbig2dec-CVE-2017-7976.patch b/gnu/packages/patches/jbig2dec-CVE-2017-7976.patch deleted file mode 100644 index 2fe02358b8..0000000000 --- a/gnu/packages/patches/jbig2dec-CVE-2017-7976.patch +++ /dev/null @@ -1,122 +0,0 @@ -Fix CVE-2017-7976: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7976 -https://bugs.ghostscript.com/show_bug.cgi?id=697683 - -In order to make the bug-fix patch apply, we also include an earlier commit -that it depends on. - -Patches copied from upstream source repository: - -Earlier commit, creating context for the CVE fix: -https://git.ghostscript.com/?p=jbig2dec.git;a=commit;h=9d2c4f3bdb0bd003deae788e7187c0f86e624544 - -CVE-2017-7976 bug fix: -https://git.ghostscript.com/?p=jbig2dec.git;a=commit;h=cfa054925de49675ac5445515ebf036fa9379ac6 - -From 9d2c4f3bdb0bd003deae788e7187c0f86e624544 Mon Sep 17 00:00:00 2001 -From: Tor Andersson <tor.andersson@artifex.com> -Date: Wed, 14 Dec 2016 15:56:31 +0100 -Subject: [PATCH] Fix warnings: remove unsigned < 0 tests that are always - false. - ---- - jbig2_image.c | 2 +- - jbig2_mmr.c | 2 +- - jbig2_symbol_dict.c | 9 ++------- - 3 files changed, 4 insertions(+), 9 deletions(-) - -diff --git a/jbig2_image.c b/jbig2_image.c -index 94e5a4c..00f966b 100644 ---- a/jbig2_image.c -+++ b/jbig2_image.c -@@ -256,7 +256,7 @@ jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int - /* general OR case */ - s = ss; - d = dd = dst->data + y * dst->stride + leftbyte; -- if (d < dst->data || leftbyte > dst->stride || h * dst->stride < 0 || d - leftbyte + h * dst->stride > dst->data + dst->height * dst->stride) { -+ if (d < dst->data || leftbyte > dst->stride || d - leftbyte + h * dst->stride > dst->data + dst->height * dst->stride) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "preventing heap overflow in jbig2_image_compose"); - } - if (leftbyte == rightbyte) { -diff --git a/jbig2_mmr.c b/jbig2_mmr.c -index 390e27c..da54934 100644 ---- a/jbig2_mmr.c -+++ b/jbig2_mmr.c -@@ -977,7 +977,7 @@ jbig2_decode_mmr_line(Jbig2MmrCtx *mmr, const byte *ref, byte *dst) - if (b1 < 2) - break; - if (c) { -- if (b1 - 2 < a0 || a0 < 0) -+ if (a0 == MINUS1 || b1 - 2 < a0) - return -1; - jbig2_set_bits(dst, a0, b1 - 2); - } -diff --git a/jbig2_symbol_dict.c b/jbig2_symbol_dict.c -index 11a2252..4acaba9 100644 ---- a/jbig2_symbol_dict.c -+++ b/jbig2_symbol_dict.c -@@ -92,11 +92,6 @@ jbig2_sd_new(Jbig2Ctx *ctx, uint32_t n_symbols) - { - Jbig2SymbolDict *new_dict = NULL; - -- if (n_symbols < 0) { -- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "Negative number of symbols in symbol dict: %d", n_symbols); -- return NULL; -- } -- - new_dict = jbig2_new(ctx, Jbig2SymbolDict, 1); - if (new_dict != NULL) { - new_dict->glyphs = jbig2_new(ctx, Jbig2Image *, n_symbols); -@@ -613,7 +608,7 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx, - uint32_t j; - int x; - -- if (code || (BMSIZE < 0)) { -+ if (code) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error decoding size of collective bitmap!"); - goto cleanup4; - } -@@ -716,7 +711,7 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx, - code = jbig2_arith_int_decode(IAEX, as, (int32_t *)&exrunlength); - /* prevent infinite loop */ - zerolength = exrunlength > 0 ? 0 : zerolength + 1; -- if (code || (exrunlength > limit - i) || (exrunlength < 0) || (zerolength > 4) || (exflag && (exrunlength + j > params->SDNUMEXSYMS))) { -+ if (code || (exrunlength > limit - i) || (zerolength > 4) || (exflag && (exrunlength + j > params->SDNUMEXSYMS))) { - if (code) - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to decode exrunlength for exported symbols"); - else if (exrunlength <= 0) --- -2.13.0 - -From cfa054925de49675ac5445515ebf036fa9379ac6 Mon Sep 17 00:00:00 2001 -From: Shailesh Mistry <shailesh.mistry@hotmail.co.uk> -Date: Wed, 10 May 2017 17:50:39 +0100 -Subject: [PATCH] Bug 697683: Bounds check before reading from image source - data. - -Add extra check to prevent reading off the end of the image source -data buffer. - -Thank you to Dai Ge for finding this issue and suggesting a patch. ---- - jbig2_image.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/jbig2_image.c b/jbig2_image.c -index 661d0a5..ae161b9 100644 ---- a/jbig2_image.c -+++ b/jbig2_image.c -@@ -263,7 +263,8 @@ jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int - /* general OR case */ - s = ss; - d = dd = dst->data + y * dst->stride + leftbyte; -- if (d < dst->data || leftbyte > dst->stride || d - leftbyte + h * dst->stride > dst->data + dst->height * dst->stride) { -+ if (d < dst->data || leftbyte > dst->stride || d - leftbyte + h * dst->stride > dst->data + dst->height * dst->stride || -+ s - leftbyte + (h - 1) * src->stride + rightbyte > src->data + src->height * src->stride) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "preventing heap overflow in jbig2_image_compose"); - } - if (leftbyte == rightbyte) { --- -2.13.0 - diff --git a/gnu/packages/patches/jbig2dec-ignore-testtest.patch b/gnu/packages/patches/jbig2dec-ignore-testtest.patch index 1efde8628c..7c80c545e9 100644 --- a/gnu/packages/patches/jbig2dec-ignore-testtest.patch +++ b/gnu/packages/patches/jbig2dec-ignore-testtest.patch @@ -1,8 +1,8 @@ -Do not run the "testtest script", it doesn't seem to do anything and reports -failiute. TODO: Actually fix the test instead of ignoring it. +Do not run the test 'test_jbig2dec.py'. It doesn't seem to do anything +and reports failure. TODO: Actually fix the test instead of ignoring it. diff --git a/Makefile.in b/Makefile.in -index 0573592..1a5de77 100644 +index 63982d4..8af1d61 100644 --- a/Makefile.in +++ b/Makefile.in @@ -93,7 +93,7 @@ host_triplet = @host@ diff --git a/gnu/packages/patches/libgnome-encoding.patch b/gnu/packages/patches/libgnome-encoding.patch new file mode 100644 index 0000000000..c7c352172f --- /dev/null +++ b/gnu/packages/patches/libgnome-encoding.patch @@ -0,0 +1,16 @@ +Remove non-UTF-8 character (this is a NO-BREAK SPACE character, encoded in +ISO-8859-1) to fix build failure with 'glib-mkenums' in GLib 2.54.2+. + +Patch from <https://github.com/macports/macports-ports/commit/1f3efc8e65cc060d1701407bd1e56e62e6bd9c55>. + +--- a/libgnome/gnome-config.h 2009-04-23 04:29:13.000000000 -0500 ++++ b/libgnome/gnome-config.h 2017-10-04 02:17:22.000000000 -0500 +@@ -270,7 +270,7 @@ void gnome_config_clean_key_ (const char + #define gnome_config_private_clean_key(path) \ + (gnome_config_clean_key_((path),TRUE)) + +-/* returns the true filename of the config file */ ++/* returns the true filename of the config file */ + #define gnome_config_get_real_path(path) \ + (g_build_filename (gnome_user_dir_get(),(path),NULL)) + #define gnome_config_private_get_real_path(path) \ diff --git a/gnu/packages/patches/libgnomeui-utf8.patch b/gnu/packages/patches/libgnomeui-utf8.patch new file mode 100644 index 0000000000..304d74e1e2 --- /dev/null +++ b/gnu/packages/patches/libgnomeui-utf8.patch @@ -0,0 +1,51 @@ +Fixes build with Python >= 3.6: + +------ +Making all in libgnomeui +make[2]: Entering directory '/tmp/guix-build-libgnomeui-2.24.5.drv-0/libgnomeui-2.24.5/libgnomeui' + GEN stamp-gnome-marshal.h + GEN stamp-gnometypebuiltins.h +INFO: Reading ./gnome-marshal.list... + GEN gnome-marshal.h +Traceback (most recent call last): + File "/gnu/store/azh1is0xknn4xphwj33iqcb5ic9qhk8l-glib-2.54.2-bin/bin/glib-mkenums", line 688, in <module> + process_file(fname) + File "/gnu/store/azh1is0xknn4xphwj33iqcb5ic9qhk8l-glib-2.54.2-bin/bin/glib-mkenums", line 420, in process_file + line = curfile.readline() + File "/gnu/store/3lkypf5wnsnvkaidhw0pv7k3yjfh1r9g-python-3.6.3/lib/python3.6/codecs.py", line 321, in decode + (result, consumed) = self._buffer_decode(data, self.errors, final) +UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 1009: invalid continuation byte +make[2]: *** [Makefile:1109: stamp-gnometypebuiltins.h] Error 1 +make[2]: Leaving directory '/tmp/guix-build-libgnomeui-2.24.5.drv-0/libgnomeui-2.24.5/libgnomeui' +make[1]: *** [Makefile:369: all-recursive] Error 1 +make[1]: Leaving directory '/tmp/guix-build-libgnomeui-2.24.5.drv-0/libgnomeui-2.24.5' +make: *** [Makefile:296: all] Error 2 +------ + +Patch copied from upstream source repository: + +https://git.gnome.org/browse/libgnomeui/commit/?id=30334c28794ef85d8973f4ed0779b5ceed6594f2 + +From 30334c28794ef85d8973f4ed0779b5ceed6594f2 Mon Sep 17 00:00:00 2001 +From: Colin Walters <walters@verbum.org> +Date: Mon, 7 Aug 2017 13:15:26 -0400 +Subject: [PATCH] gnome-scores.h: Convert to UTF-8 + +The new Python `glib-mkenums` barfs on ISO-8859-1 input. +--- + libgnomeui/gnome-scores.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgnomeui/gnome-scores.h b/libgnomeui/gnome-scores.h +index 911b12d1..4e641d22 100644 +--- a/libgnomeui/gnome-scores.h ++++ b/libgnomeui/gnome-scores.h +@@ -27,7 +27,7 @@ + * "High Scores" Widget + * + * AUTHOR: +- * Horacio J. Peña <horape@compendium.com.ar> ++ * Horacio J. Peña <horape@compendium.com.ar> + * + * This is free software (under the terms of the GNU LGPL) + * diff --git a/gnu/packages/patches/libtiff-CVE-2016-10688.patch b/gnu/packages/patches/libtiff-CVE-2016-10688.patch deleted file mode 100644 index 1630274c61..0000000000 --- a/gnu/packages/patches/libtiff-CVE-2016-10688.patch +++ /dev/null @@ -1,92 +0,0 @@ -Fix CVE-2017-10688: - -http://bugzilla.maptools.org/show_bug.cgi?id=2712 -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-10688 -https://security-tracker.debian.org/tracker/CVE-2017-10688 - -Patch lifted from upstream source repository (the changes to 'ChangeLog' -don't apply to the libtiff 4.0.8 release tarball). - -3rd party Git reference: - -https://github.com/vadz/libtiff/commit/6173a57d39e04d68b139f8c1aa499a24dbe74ba1 - -2017-06-30 Even Rouault <even.rouault at spatialys.com> - - * libtiff/tif_dirwrite.c: in TIFFWriteDirectoryTagCheckedXXXX() - functions associated with LONG8/SLONG8 data type, replace assertion -that - the file is BigTIFF, by a non-fatal error. - Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2712 - Reported by team OWL337 - - - -/cvs/maptools/cvsroot/libtiff/ChangeLog,v <-- ChangeLog -new revision: 1.1259; previous revision: 1.1258 -/cvs/maptools/cvsroot/libtiff/libtiff/tif_dirwrite.c,v <-- -libtiff/tif_dirwrite.c -new revision: 1.86; previous revision: 1.85 - -Index: libtiff/libtiff/tif_dirwrite.c -=================================================================== -RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirwrite.c,v -retrieving revision 1.85 -retrieving revision 1.86 -diff -u -r1.85 -r1.86 ---- libtiff/libtiff/tif_dirwrite.c 11 Jan 2017 16:09:02 -0000 1.85 -+++ libtiff/libtiff/tif_dirwrite.c 30 Jun 2017 17:29:44 -0000 1.86 -@@ -1,4 +1,4 @@ --/* $Id: tif_dirwrite.c,v 1.85 2017-01-11 16:09:02 erouault Exp $ */ -+/* $Id: tif_dirwrite.c,v 1.86 2017-06-30 17:29:44 erouault Exp $ */ - - /* - * Copyright (c) 1988-1997 Sam Leffler -@@ -2111,7 +2111,10 @@ - { - uint64 m; - assert(sizeof(uint64)==8); -- assert(tif->tif_flags&TIFF_BIGTIFF); -+ if( !(tif->tif_flags&TIFF_BIGTIFF) ) { -+ TIFFErrorExt(tif->tif_clientdata,"TIFFWriteDirectoryTagCheckedLong8","LONG8 not allowed for ClassicTIFF"); -+ return(0); -+ } - m=value; - if (tif->tif_flags&TIFF_SWAB) - TIFFSwabLong8(&m); -@@ -2124,7 +2127,10 @@ - { - assert(count<0x20000000); - assert(sizeof(uint64)==8); -- assert(tif->tif_flags&TIFF_BIGTIFF); -+ if( !(tif->tif_flags&TIFF_BIGTIFF) ) { -+ TIFFErrorExt(tif->tif_clientdata,"TIFFWriteDirectoryTagCheckedLong8","LONG8 not allowed for ClassicTIFF"); -+ return(0); -+ } - if (tif->tif_flags&TIFF_SWAB) - TIFFSwabArrayOfLong8(value,count); - return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_LONG8,count,count*8,value)); -@@ -2136,7 +2142,10 @@ - { - int64 m; - assert(sizeof(int64)==8); -- assert(tif->tif_flags&TIFF_BIGTIFF); -+ if( !(tif->tif_flags&TIFF_BIGTIFF) ) { -+ TIFFErrorExt(tif->tif_clientdata,"TIFFWriteDirectoryTagCheckedLong8","SLONG8 not allowed for ClassicTIFF"); -+ return(0); -+ } - m=value; - if (tif->tif_flags&TIFF_SWAB) - TIFFSwabLong8((uint64*)(&m)); -@@ -2149,7 +2158,10 @@ - { - assert(count<0x20000000); - assert(sizeof(int64)==8); -- assert(tif->tif_flags&TIFF_BIGTIFF); -+ if( !(tif->tif_flags&TIFF_BIGTIFF) ) { -+ TIFFErrorExt(tif->tif_clientdata,"TIFFWriteDirectoryTagCheckedLong8","SLONG8 not allowed for ClassicTIFF"); -+ return(0); -+ } - if (tif->tif_flags&TIFF_SWAB) - TIFFSwabArrayOfLong8((uint64*)value,count); - return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SLONG8,count,count*8,value)); diff --git a/gnu/packages/patches/libtiff-CVE-2017-9936.patch b/gnu/packages/patches/libtiff-CVE-2017-9936.patch deleted file mode 100644 index fbdbcd0f0b..0000000000 --- a/gnu/packages/patches/libtiff-CVE-2017-9936.patch +++ /dev/null @@ -1,47 +0,0 @@ -Fix CVE-2017-9936: - -http://bugzilla.maptools.org/show_bug.cgi?id=2706 -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9936 -https://security-tracker.debian.org/tracker/CVE-2017-9936 - -Patch lifted from upstream source repository (the changes to 'ChangeLog' -don't apply to the libtiff 4.0.8 release tarball). - -3rd party Git reference: - -https://github.com/vadz/libtiff/commit/fe8d7165956b88df4837034a9161dc5fd20cf67a - -2017-06-26 Even Rouault <even.rouault at spatialys.com> - - * libtiff/tif_jbig.c: fix memory leak in error code path of -JBIGDecode() - Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2706 - Reported by team OWL337 - -/cvs/maptools/cvsroot/libtiff/ChangeLog,v <-- ChangeLog -new revision: 1.1254; previous revision: 1.1253 -/cvs/maptools/cvsroot/libtiff/libtiff/tif_jbig.c,v <-- libtiff/tif_jbig.c -new revision: 1.16; previous revision: 1.15 - -Index: libtiff/libtiff/tif_jbig.c -=================================================================== -RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_jbig.c,v -retrieving revision 1.15 -retrieving revision 1.16 -diff -u -r1.15 -r1.16 ---- libtiff/libtiff/tif_jbig.c 10 Mar 2010 18:56:48 -0000 1.15 -+++ libtiff/libtiff/tif_jbig.c 26 Jun 2017 15:20:00 -0000 1.16 -@@ -1,4 +1,4 @@ --/* $Id: tif_jbig.c,v 1.15 2010-03-10 18:56:48 bfriesen Exp $ */ -+/* $Id: tif_jbig.c,v 1.16 2017-06-26 15:20:00 erouault Exp $ */ - - /* - * Copyright (c) 1988-1997 Sam Leffler -@@ -94,6 +94,7 @@ - jbg_strerror(decodeStatus) - #endif - ); -+ jbg_dec_free(&decoder); - return 0; - } - diff --git a/gnu/packages/patches/libtiff-tiffgetfield-bugs.patch b/gnu/packages/patches/libtiff-tiffgetfield-bugs.patch deleted file mode 100644 index 84566ca23e..0000000000 --- a/gnu/packages/patches/libtiff-tiffgetfield-bugs.patch +++ /dev/null @@ -1,201 +0,0 @@ -Fix several bugs in libtiff related to use of TIFFGetField(): - -http://bugzilla.maptools.org/show_bug.cgi?id=2580 -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-8128 -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-7554 -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-5318 -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-10095 - -Patch copied from upstream CVS. 3rd-party Git reference: -https://github.com/vadz/libtiff/commit/4d4fa0b68ae9ae038959ee4f69ebe288ec892f06 - -2017-06-01 Even Rouault <even.rouault at spatialys.com> - -* libtiff/tif_dirinfo.c, tif_dirread.c: add _TIFFCheckFieldIsValidForCodec(), -and use it in TIFFReadDirectory() so as to ignore fields whose tag is a -codec-specified tag but this codec is not enabled. This avoids TIFFGetField() -to behave differently depending on whether the codec is enabled or not, and -thus can avoid stack based buffer overflows in a number of TIFF utilities -such as tiffsplit, tiffcmp, thumbnail, etc. -Patch derived from 0063-Handle-properly-CODEC-specific-tags.patch -(http://bugzilla.maptools.org/show_bug.cgi?id=2580) by Raphaël Hertzog. -Fixes: -http://bugzilla.maptools.org/show_bug.cgi?id=2580 -http://bugzilla.maptools.org/show_bug.cgi?id=2693 -http://bugzilla.maptools.org/show_bug.cgi?id=2625 (CVE-2016-10095) -http://bugzilla.maptools.org/show_bug.cgi?id=2564 (CVE-2015-7554) -http://bugzilla.maptools.org/show_bug.cgi?id=2561 (CVE-2016-5318) -http://bugzilla.maptools.org/show_bug.cgi?id=2499 (CVE-2014-8128) -http://bugzilla.maptools.org/show_bug.cgi?id=2441 -http://bugzilla.maptools.org/show_bug.cgi?id=2433 -Index: libtiff/libtiff/tif_dirread.c -=================================================================== -RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirread.c,v -retrieving revision 1.208 -retrieving revision 1.209 -diff -u -r1.208 -r1.209 ---- libtiff/libtiff/tif_dirread.c 27 Apr 2017 15:46:22 -0000 1.208 -+++ libtiff/libtiff/tif_dirread.c 1 Jun 2017 12:44:04 -0000 1.209 -@@ -1,4 +1,4 @@ --/* $Id: tif_dirread.c,v 1.208 2017-04-27 15:46:22 erouault Exp $ */ -+/* $Id: tif_dirread.c,v 1.209 2017-06-01 12:44:04 erouault Exp $ */ - - /* - * Copyright (c) 1988-1997 Sam Leffler -@@ -3580,6 +3580,10 @@ - goto bad; - dp->tdir_tag=IGNORE; - break; -+ default: -+ if( !_TIFFCheckFieldIsValidForCodec(tif, dp->tdir_tag) ) -+ dp->tdir_tag=IGNORE; -+ break; - } - } - } -Index: libtiff/libtiff/tif_dirinfo.c -=================================================================== -RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirinfo.c,v -retrieving revision 1.126 -retrieving revision 1.127 -diff -u -r1.126 -r1.127 ---- libtiff/libtiff/tif_dirinfo.c 18 Nov 2016 02:52:13 -0000 1.126 -+++ libtiff/libtiff/tif_dirinfo.c 1 Jun 2017 12:44:04 -0000 1.127 -@@ -1,4 +1,4 @@ --/* $Id: tif_dirinfo.c,v 1.126 2016-11-18 02:52:13 bfriesen Exp $ */ -+/* $Id: tif_dirinfo.c,v 1.127 2017-06-01 12:44:04 erouault Exp $ */ - - /* - * Copyright (c) 1988-1997 Sam Leffler -@@ -956,6 +956,109 @@ - return 0; - } - -+int -+_TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag) -+{ -+ /* Filter out non-codec specific tags */ -+ switch (tag) { -+ /* Shared tags */ -+ case TIFFTAG_PREDICTOR: -+ /* JPEG tags */ -+ case TIFFTAG_JPEGTABLES: -+ /* OJPEG tags */ -+ case TIFFTAG_JPEGIFOFFSET: -+ case TIFFTAG_JPEGIFBYTECOUNT: -+ case TIFFTAG_JPEGQTABLES: -+ case TIFFTAG_JPEGDCTABLES: -+ case TIFFTAG_JPEGACTABLES: -+ case TIFFTAG_JPEGPROC: -+ case TIFFTAG_JPEGRESTARTINTERVAL: -+ /* CCITT* */ -+ case TIFFTAG_BADFAXLINES: -+ case TIFFTAG_CLEANFAXDATA: -+ case TIFFTAG_CONSECUTIVEBADFAXLINES: -+ case TIFFTAG_GROUP3OPTIONS: -+ case TIFFTAG_GROUP4OPTIONS: -+ break; -+ default: -+ return 1; -+ } -+ /* Check if codec specific tags are allowed for the current -+ * compression scheme (codec) */ -+ switch (tif->tif_dir.td_compression) { -+ case COMPRESSION_LZW: -+ if (tag == TIFFTAG_PREDICTOR) -+ return 1; -+ break; -+ case COMPRESSION_PACKBITS: -+ /* No codec-specific tags */ -+ break; -+ case COMPRESSION_THUNDERSCAN: -+ /* No codec-specific tags */ -+ break; -+ case COMPRESSION_NEXT: -+ /* No codec-specific tags */ -+ break; -+ case COMPRESSION_JPEG: -+ if (tag == TIFFTAG_JPEGTABLES) -+ return 1; -+ break; -+ case COMPRESSION_OJPEG: -+ switch (tag) { -+ case TIFFTAG_JPEGIFOFFSET: -+ case TIFFTAG_JPEGIFBYTECOUNT: -+ case TIFFTAG_JPEGQTABLES: -+ case TIFFTAG_JPEGDCTABLES: -+ case TIFFTAG_JPEGACTABLES: -+ case TIFFTAG_JPEGPROC: -+ case TIFFTAG_JPEGRESTARTINTERVAL: -+ return 1; -+ } -+ break; -+ case COMPRESSION_CCITTRLE: -+ case COMPRESSION_CCITTRLEW: -+ case COMPRESSION_CCITTFAX3: -+ case COMPRESSION_CCITTFAX4: -+ switch (tag) { -+ case TIFFTAG_BADFAXLINES: -+ case TIFFTAG_CLEANFAXDATA: -+ case TIFFTAG_CONSECUTIVEBADFAXLINES: -+ return 1; -+ case TIFFTAG_GROUP3OPTIONS: -+ if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3) -+ return 1; -+ break; -+ case TIFFTAG_GROUP4OPTIONS: -+ if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4) -+ return 1; -+ break; -+ } -+ break; -+ case COMPRESSION_JBIG: -+ /* No codec-specific tags */ -+ break; -+ case COMPRESSION_DEFLATE: -+ case COMPRESSION_ADOBE_DEFLATE: -+ if (tag == TIFFTAG_PREDICTOR) -+ return 1; -+ break; -+ case COMPRESSION_PIXARLOG: -+ if (tag == TIFFTAG_PREDICTOR) -+ return 1; -+ break; -+ case COMPRESSION_SGILOG: -+ case COMPRESSION_SGILOG24: -+ /* No codec-specific tags */ -+ break; -+ case COMPRESSION_LZMA: -+ if (tag == TIFFTAG_PREDICTOR) -+ return 1; -+ break; -+ -+ } -+ return 0; -+} -+ - /* vim: set ts=8 sts=8 sw=8 noet: */ - - /* -Index: libtiff/libtiff/tif_dir.h -=================================================================== -RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dir.h,v -retrieving revision 1.54 -retrieving revision 1.55 -diff -u -r1.54 -r1.55 ---- libtiff/libtiff/tif_dir.h 18 Feb 2011 20:53:05 -0000 1.54 -+++ libtiff/libtiff/tif_dir.h 1 Jun 2017 12:44:04 -0000 1.55 -@@ -1,4 +1,4 @@ --/* $Id: tif_dir.h,v 1.54 2011-02-18 20:53:05 fwarmerdam Exp $ */ -+/* $Id: tif_dir.h,v 1.55 2017-06-01 12:44:04 erouault Exp $ */ - - /* - * Copyright (c) 1988-1997 Sam Leffler -@@ -291,6 +291,7 @@ - extern int _TIFFMergeFields(TIFF*, const TIFFField[], uint32); - extern const TIFFField* _TIFFFindOrRegisterField(TIFF *, uint32, TIFFDataType); - extern TIFFField* _TIFFCreateAnonField(TIFF *, uint32, TIFFDataType); -+extern int _TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag); - - #if defined(__cplusplus) - } diff --git a/gnu/packages/patches/libtiff-tiffycbcrtorgb-integer-overflow.patch b/gnu/packages/patches/libtiff-tiffycbcrtorgb-integer-overflow.patch deleted file mode 100644 index 060740d953..0000000000 --- a/gnu/packages/patches/libtiff-tiffycbcrtorgb-integer-overflow.patch +++ /dev/null @@ -1,57 +0,0 @@ -Fix an integer overflow TIFFYCbCrtoRGB(): - -https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1844 - -3rd party Git reference: - -https://github.com/vadz/libtiff/commit/02669064e927074819ce1ed39aba0fccaa167717 - -2017-05-29 Even Rouault <even.rouault at spatialys.com> - - * libtiff/tif_color.c: TIFFYCbCrToRGBInit(): stricter clamping to avoid - int32 overflow in TIFFYCbCrtoRGB(). - Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1844 - Credit to OSS Fuzz - - -/cvs/maptools/cvsroot/libtiff/ChangeLog,v <-- ChangeLog -new revision: 1.1241; previous revision: 1.1240 -/cvs/maptools/cvsroot/libtiff/libtiff/tif_color.c,v <-- libtiff/tif_color.c -new revision: 1.24; previous revision: 1.23 - -Index: libtiff/libtiff/tif_color.c -=================================================================== -RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_color.c,v -retrieving revision 1.23 -retrieving revision 1.24 -diff -u -r1.23 -r1.24 ---- libtiff/libtiff/tif_color.c 13 May 2017 18:17:34 -0000 1.23 -+++ libtiff/libtiff/tif_color.c 29 May 2017 10:12:54 -0000 1.24 -@@ -1,4 +1,4 @@ --/* $Id: tif_color.c,v 1.23 2017-05-13 18:17:34 erouault Exp $ */ -+/* $Id: tif_color.c,v 1.24 2017-05-29 10:12:54 erouault Exp $ */ - - /* - * Copyright (c) 1988-1997 Sam Leffler -@@ -275,10 +275,10 @@ - for (i = 0, x = -128; i < 256; i++, x++) { - int32 Cr = (int32)CLAMPw(Code2V(x, refBlackWhite[4] - 128.0F, - refBlackWhite[5] - 128.0F, 127), -- -128.0F * 64, 128.0F * 64); -+ -128.0F * 32, 128.0F * 32); - int32 Cb = (int32)CLAMPw(Code2V(x, refBlackWhite[2] - 128.0F, - refBlackWhite[3] - 128.0F, 127), -- -128.0F * 64, 128.0F * 64); -+ -128.0F * 32, 128.0F * 32); - - ycbcr->Cr_r_tab[i] = (int32)((D1*Cr + ONE_HALF)>>SHIFT); - ycbcr->Cb_b_tab[i] = (int32)((D3*Cb + ONE_HALF)>>SHIFT); -@@ -286,7 +286,7 @@ - ycbcr->Cb_g_tab[i] = D4*Cb + ONE_HALF; - ycbcr->Y_tab[i] = - (int32)CLAMPw(Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255), -- -128.0F * 64, 128.0F * 64); -+ -128.0F * 32, 128.0F * 32); - } - } - diff --git a/gnu/packages/patches/libtiff-tiffycbcrtorgbinit-integer-overflow.patch b/gnu/packages/patches/libtiff-tiffycbcrtorgbinit-integer-overflow.patch deleted file mode 100644 index a990641a49..0000000000 --- a/gnu/packages/patches/libtiff-tiffycbcrtorgbinit-integer-overflow.patch +++ /dev/null @@ -1,43 +0,0 @@ -Fix an integer overflow in initYCbCrConversion(): - -https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1907 - -3rd party Git reference - -https://github.com/vadz/libtiff/commit/468988860e0dae62ebbf991627c74bcbb4bd256f - - * libtiff/tif_getimage.c: initYCbCrConversion(): stricter validation for - refBlackWhite coefficients values. To avoid invalid float->int32 conversion - (when refBlackWhite[0] == 2147483648.f) - Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1907 - Credit to OSS Fuzz - - -/cvs/maptools/cvsroot/libtiff/ChangeLog,v <-- ChangeLog -new revision: 1.1243; previous revision: 1.1242 -/cvs/maptools/cvsroot/libtiff/libtiff/tif_getimage.c,v <-- libtiff/tif_getimage.c -new revision: 1.107; previous revision: 1.106 - -Index: libtiff/libtiff/tif_getimage.c -=================================================================== -RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_getimage.c,v -retrieving revision 1.106 -retrieving revision 1.107 -diff -u -r1.106 -r1.107 ---- libtiff/libtiff/tif_getimage.c 20 May 2017 11:29:02 -0000 1.106 -+++ libtiff/libtiff/tif_getimage.c 29 May 2017 11:29:06 -0000 1.107 -@@ -1,4 +1,4 @@ --/* $Id: tif_getimage.c,v 1.106 2017-05-20 11:29:02 erouault Exp $ */ -+/* $Id: tif_getimage.c,v 1.107 2017-05-29 11:29:06 erouault Exp $ */ - - /* - * Copyright (c) 1991-1997 Sam Leffler -@@ -2241,7 +2241,7 @@ - - static int isInRefBlackWhiteRange(float f) - { -- return f >= (float)(-0x7FFFFFFF + 128) && f <= (float)0x7FFFFFFF; -+ return f > (float)(-0x7FFFFFFF + 128) && f < (float)0x7FFFFFFF; - } - - static int diff --git a/gnu/packages/patches/libtirpc-CVE-2017-8779.patch b/gnu/packages/patches/libtirpc-CVE-2017-8779.patch deleted file mode 100644 index 742e64df25..0000000000 --- a/gnu/packages/patches/libtirpc-CVE-2017-8779.patch +++ /dev/null @@ -1,263 +0,0 @@ -Fix CVE-2017-8779: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8779 - -Patch copied from the bug reporter's 3rd-party repository: - -https://github.com/guidovranken/rpcbomb/blob/master/libtirpc_patch.txt - -diff --git a/src/rpc_generic.c b/src/rpc_generic.c -index 2f09a8f..589cbd5 100644 ---- a/src/rpc_generic.c -+++ b/src/rpc_generic.c -@@ -615,6 +615,9 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf) - - switch (af) { - case AF_INET: -+ if (nbuf->len < sizeof(*sin)) { -+ return NULL; -+ } - sin = nbuf->buf; - if (inet_ntop(af, &sin->sin_addr, namebuf, sizeof namebuf) - == NULL) -@@ -626,6 +629,9 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf) - break; - #ifdef INET6 - case AF_INET6: -+ if (nbuf->len < sizeof(*sin6)) { -+ return NULL; -+ } - sin6 = nbuf->buf; - if (inet_ntop(af, &sin6->sin6_addr, namebuf6, sizeof namebuf6) - == NULL) -@@ -667,6 +673,8 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr) - - port = 0; - sin = NULL; -+ if (uaddr == NULL) -+ return NULL; - addrstr = strdup(uaddr); - if (addrstr == NULL) - return NULL; -diff --git a/src/rpcb_prot.c b/src/rpcb_prot.c -index 43fd385..a923c8e 100644 ---- a/src/rpcb_prot.c -+++ b/src/rpcb_prot.c -@@ -41,6 +41,7 @@ - #include <rpc/types.h> - #include <rpc/xdr.h> - #include <rpc/rpcb_prot.h> -+#include "rpc_com.h" - - bool_t - xdr_rpcb(xdrs, objp) -@@ -53,13 +54,13 @@ xdr_rpcb(xdrs, objp) - if (!xdr_u_int32_t(xdrs, &objp->r_vers)) { - return (FALSE); - } -- if (!xdr_string(xdrs, &objp->r_netid, (u_int)~0)) { -+ if (!xdr_string(xdrs, &objp->r_netid, RPC_MAXDATASIZE)) { - return (FALSE); - } -- if (!xdr_string(xdrs, &objp->r_addr, (u_int)~0)) { -+ if (!xdr_string(xdrs, &objp->r_addr, RPC_MAXDATASIZE)) { - return (FALSE); - } -- if (!xdr_string(xdrs, &objp->r_owner, (u_int)~0)) { -+ if (!xdr_string(xdrs, &objp->r_owner, RPC_MAXDATASIZE)) { - return (FALSE); - } - return (TRUE); -@@ -159,19 +160,19 @@ xdr_rpcb_entry(xdrs, objp) - XDR *xdrs; - rpcb_entry *objp; - { -- if (!xdr_string(xdrs, &objp->r_maddr, (u_int)~0)) { -+ if (!xdr_string(xdrs, &objp->r_maddr, RPC_MAXDATASIZE)) { - return (FALSE); - } -- if (!xdr_string(xdrs, &objp->r_nc_netid, (u_int)~0)) { -+ if (!xdr_string(xdrs, &objp->r_nc_netid, RPC_MAXDATASIZE)) { - return (FALSE); - } - if (!xdr_u_int32_t(xdrs, &objp->r_nc_semantics)) { - return (FALSE); - } -- if (!xdr_string(xdrs, &objp->r_nc_protofmly, (u_int)~0)) { -+ if (!xdr_string(xdrs, &objp->r_nc_protofmly, RPC_MAXDATASIZE)) { - return (FALSE); - } -- if (!xdr_string(xdrs, &objp->r_nc_proto, (u_int)~0)) { -+ if (!xdr_string(xdrs, &objp->r_nc_proto, RPC_MAXDATASIZE)) { - return (FALSE); - } - return (TRUE); -@@ -292,7 +293,7 @@ xdr_rpcb_rmtcallres(xdrs, p) - bool_t dummy; - struct r_rpcb_rmtcallres *objp = (struct r_rpcb_rmtcallres *)(void *)p; - -- if (!xdr_string(xdrs, &objp->addr, (u_int)~0)) { -+ if (!xdr_string(xdrs, &objp->addr, RPC_MAXDATASIZE)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->results.results_len)) { -@@ -312,6 +313,11 @@ xdr_netbuf(xdrs, objp) - if (!xdr_u_int32_t(xdrs, (u_int32_t *) &objp->maxlen)) { - return (FALSE); - } -+ -+ if (objp->maxlen > RPC_MAXDATASIZE) { -+ return (FALSE); -+ } -+ - dummy = xdr_bytes(xdrs, (char **)&(objp->buf), - (u_int *)&(objp->len), objp->maxlen); - return (dummy); -diff --git a/src/rpcb_st_xdr.c b/src/rpcb_st_xdr.c -index 08db745..28e6a48 100644 ---- a/src/rpcb_st_xdr.c -+++ b/src/rpcb_st_xdr.c -@@ -37,6 +37,7 @@ - - - #include <rpc/rpc.h> -+#include "rpc_com.h" - - /* Link list of all the stats about getport and getaddr */ - -@@ -58,7 +59,7 @@ xdr_rpcbs_addrlist(xdrs, objp) - if (!xdr_int(xdrs, &objp->failure)) { - return (FALSE); - } -- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { -+ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) { - return (FALSE); - } - -@@ -109,7 +110,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp) - IXDR_PUT_INT32(buf, objp->failure); - IXDR_PUT_INT32(buf, objp->indirect); - } -- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { -+ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) { - return (FALSE); - } - if (!xdr_pointer(xdrs, (char **)&objp->next, -@@ -147,7 +148,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp) - objp->failure = (int)IXDR_GET_INT32(buf); - objp->indirect = (int)IXDR_GET_INT32(buf); - } -- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { -+ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) { - return (FALSE); - } - if (!xdr_pointer(xdrs, (char **)&objp->next, -@@ -175,7 +176,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp) - if (!xdr_int(xdrs, &objp->indirect)) { - return (FALSE); - } -- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { -+ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) { - return (FALSE); - } - if (!xdr_pointer(xdrs, (char **)&objp->next, -diff --git a/src/xdr.c b/src/xdr.c -index f3fb9ad..b9a1558 100644 ---- a/src/xdr.c -+++ b/src/xdr.c -@@ -42,8 +42,10 @@ - #include <stdlib.h> - #include <string.h> - -+#include <rpc/rpc.h> - #include <rpc/types.h> - #include <rpc/xdr.h> -+#include <rpc/rpc_com.h> - - typedef quad_t longlong_t; /* ANSI long long type */ - typedef u_quad_t u_longlong_t; /* ANSI unsigned long long type */ -@@ -53,7 +55,6 @@ typedef u_quad_t u_longlong_t; /* ANSI unsigned long long type */ - */ - #define XDR_FALSE ((long) 0) - #define XDR_TRUE ((long) 1) --#define LASTUNSIGNED ((u_int) 0-1) - - /* - * for unit alignment -@@ -629,6 +630,7 @@ xdr_bytes(xdrs, cpp, sizep, maxsize) - { - char *sp = *cpp; /* sp is the actual string pointer */ - u_int nodesize; -+ bool_t ret, allocated = FALSE; - - /* - * first deal with the length since xdr bytes are counted -@@ -652,6 +654,7 @@ xdr_bytes(xdrs, cpp, sizep, maxsize) - } - if (sp == NULL) { - *cpp = sp = mem_alloc(nodesize); -+ allocated = TRUE; - } - if (sp == NULL) { - warnx("xdr_bytes: out of memory"); -@@ -660,7 +663,14 @@ xdr_bytes(xdrs, cpp, sizep, maxsize) - /* FALLTHROUGH */ - - case XDR_ENCODE: -- return (xdr_opaque(xdrs, sp, nodesize)); -+ ret = xdr_opaque(xdrs, sp, nodesize); -+ if ((xdrs->x_op == XDR_DECODE) && (ret == FALSE)) { -+ if (allocated == TRUE) { -+ free(sp); -+ *cpp = NULL; -+ } -+ } -+ return (ret); - - case XDR_FREE: - if (sp != NULL) { -@@ -754,6 +764,7 @@ xdr_string(xdrs, cpp, maxsize) - char *sp = *cpp; /* sp is the actual string pointer */ - u_int size; - u_int nodesize; -+ bool_t ret, allocated = FALSE; - - /* - * first deal with the length since xdr strings are counted-strings -@@ -793,8 +804,10 @@ xdr_string(xdrs, cpp, maxsize) - switch (xdrs->x_op) { - - case XDR_DECODE: -- if (sp == NULL) -+ if (sp == NULL) { - *cpp = sp = mem_alloc(nodesize); -+ allocated = TRUE; -+ } - if (sp == NULL) { - warnx("xdr_string: out of memory"); - return (FALSE); -@@ -803,7 +816,14 @@ xdr_string(xdrs, cpp, maxsize) - /* FALLTHROUGH */ - - case XDR_ENCODE: -- return (xdr_opaque(xdrs, sp, size)); -+ ret = xdr_opaque(xdrs, sp, size); -+ if ((xdrs->x_op == XDR_DECODE) && (ret == FALSE)) { -+ if (allocated == TRUE) { -+ free(sp); -+ *cpp = NULL; -+ } -+ } -+ return (ret); - - case XDR_FREE: - mem_free(sp, nodesize); -@@ -823,7 +843,7 @@ xdr_wrapstring(xdrs, cpp) - XDR *xdrs; - char **cpp; - { -- return xdr_string(xdrs, cpp, LASTUNSIGNED); -+ return xdr_string(xdrs, cpp, RPC_MAXDATASIZE); - } - - /* diff --git a/gnu/packages/patches/libtirpc-missing-headers.patch b/gnu/packages/patches/libtirpc-missing-headers.patch new file mode 100644 index 0000000000..5a96711820 --- /dev/null +++ b/gnu/packages/patches/libtirpc-missing-headers.patch @@ -0,0 +1,40 @@ +Fix compilation failure with glibc 2.26 caused by missing type +declarations: + +------ +xdr_sizeof.c: In function ‘x_inline’: +xdr_sizeof.c:93:13: error: ‘uintptr_t’ undeclared (first use in this function) + if (len < (uintptr_t)xdrs->x_base) { +------ + +Patch copied from upstream source repository: + +http://git.linux-nfs.org/?p=steved/libtirpc.git;a=commit;h=acb9a37977cf0a9630eac74af9adebf35e38e719 + +From acb9a37977cf0a9630eac74af9adebf35e38e719 Mon Sep 17 00:00:00 2001 +From: Thorsten Kukuk <kukuk@thkukuk.de> +Date: Tue, 14 Nov 2017 10:39:08 -0500 +Subject: [PATCH] Include stdint.h from xdr_sizeof.c to avoid missing + declaration errors. + +Signed-off-by: Thorsten Kukuk <kukuk@suse.de> +Signed-off-by: Steve Dickson <steved@redhat.com> +--- + src/xdr_sizeof.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/xdr_sizeof.c b/src/xdr_sizeof.c +index d23fbd1..79d6707 100644 +--- a/src/xdr_sizeof.c ++++ b/src/xdr_sizeof.c +@@ -39,6 +39,7 @@ + #include <rpc/xdr.h> + #include <sys/types.h> + #include <stdlib.h> ++#include <stdint.h> + #include "un-namespace.h" + + /* ARGSUSED */ +-- +1.8.3.1 + diff --git a/gnu/packages/patches/libunistring-gnulib-multi-core.patch b/gnu/packages/patches/libunistring-gnulib-multi-core.patch deleted file mode 100644 index 709b20c6d2..0000000000 --- a/gnu/packages/patches/libunistring-gnulib-multi-core.patch +++ /dev/null @@ -1,178 +0,0 @@ -This patch fixes performance problems on multi-core machines -as reported at <https://bugs.gnu.org/26441>. - -See commit 480d374e596a0ee3fed168ab42cd84c313ad3c89 in Gnulib -by Bruno Haible <bruno@clisp.org>. - -diff --git a/tests/test-lock.c b/tests/test-lock.c -index cb734b4e6..aa6de2739 100644 ---- a/tests/test-lock.c -+++ b/tests/test-lock.c -@@ -50,6 +50,13 @@ - Uncomment this to see if the operating system has a fair scheduler. */ - #define EXPLICIT_YIELD 1 - -+/* Whether to use 'volatile' on some variables that communicate information -+ between threads. If set to 0, a lock is used to protect these variables. -+ If set to 1, 'volatile' is used; this is theoretically equivalent but can -+ lead to much slower execution (e.g. 30x slower total run time on a 40-core -+ machine. */ -+#define USE_VOLATILE 0 -+ - /* Whether to print debugging messages. */ - #define ENABLE_DEBUGGING 0 - -@@ -103,6 +110,51 @@ - # define yield() - #endif - -+#if USE_VOLATILE -+struct atomic_int { -+ volatile int value; -+}; -+static void -+init_atomic_int (struct atomic_int *ai) -+{ -+} -+static int -+get_atomic_int_value (struct atomic_int *ai) -+{ -+ return ai->value; -+} -+static void -+set_atomic_int_value (struct atomic_int *ai, int new_value) -+{ -+ ai->value = new_value; -+} -+#else -+struct atomic_int { -+ gl_lock_define (, lock) -+ int value; -+}; -+static void -+init_atomic_int (struct atomic_int *ai) -+{ -+ gl_lock_init (ai->lock); -+} -+static int -+get_atomic_int_value (struct atomic_int *ai) -+{ -+ gl_lock_lock (ai->lock); -+ int ret = ai->value; -+ gl_lock_unlock (ai->lock); -+ return ret; -+} -+static void -+set_atomic_int_value (struct atomic_int *ai, int new_value) -+{ -+ gl_lock_lock (ai->lock); -+ ai->value = new_value; -+ gl_lock_unlock (ai->lock); -+} -+#endif -+ - #define ACCOUNT_COUNT 4 - - static int account[ACCOUNT_COUNT]; -@@ -170,12 +222,12 @@ lock_mutator_thread (void *arg) - return NULL; - } - --static volatile int lock_checker_done; -+static struct atomic_int lock_checker_done; - - static void * - lock_checker_thread (void *arg) - { -- while (!lock_checker_done) -+ while (get_atomic_int_value (&lock_checker_done) == 0) - { - dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ()); - gl_lock_lock (my_lock); -@@ -200,7 +252,8 @@ test_lock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- lock_checker_done = 0; -+ init_atomic_int (&lock_checker_done); -+ set_atomic_int_value (&lock_checker_done, 0); - - /* Spawn the threads. */ - checkerthread = gl_thread_create (lock_checker_thread, NULL); -@@ -210,7 +263,7 @@ test_lock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- lock_checker_done = 1; -+ set_atomic_int_value (&lock_checker_done, 1); - gl_thread_join (checkerthread, NULL); - check_accounts (); - } -@@ -254,12 +307,12 @@ rwlock_mutator_thread (void *arg) - return NULL; - } - --static volatile int rwlock_checker_done; -+static struct atomic_int rwlock_checker_done; - - static void * - rwlock_checker_thread (void *arg) - { -- while (!rwlock_checker_done) -+ while (get_atomic_int_value (&rwlock_checker_done) == 0) - { - dbgprintf ("Checker %p before check rdlock\n", gl_thread_self_pointer ()); - gl_rwlock_rdlock (my_rwlock); -@@ -284,7 +337,8 @@ test_rwlock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- rwlock_checker_done = 0; -+ init_atomic_int (&rwlock_checker_done); -+ set_atomic_int_value (&rwlock_checker_done, 0); - - /* Spawn the threads. */ - for (i = 0; i < THREAD_COUNT; i++) -@@ -295,7 +349,7 @@ test_rwlock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- rwlock_checker_done = 1; -+ set_atomic_int_value (&rwlock_checker_done, 1); - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (checkerthreads[i], NULL); - check_accounts (); -@@ -356,12 +410,12 @@ reclock_mutator_thread (void *arg) - return NULL; - } - --static volatile int reclock_checker_done; -+static struct atomic_int reclock_checker_done; - - static void * - reclock_checker_thread (void *arg) - { -- while (!reclock_checker_done) -+ while (get_atomic_int_value (&reclock_checker_done) == 0) - { - dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ()); - gl_recursive_lock_lock (my_reclock); -@@ -386,7 +440,8 @@ test_recursive_lock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- reclock_checker_done = 0; -+ init_atomic_int (&reclock_checker_done); -+ set_atomic_int_value (&reclock_checker_done, 0); - - /* Spawn the threads. */ - checkerthread = gl_thread_create (reclock_checker_thread, NULL); -@@ -396,7 +451,7 @@ test_recursive_lock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- reclock_checker_done = 1; -+ set_atomic_int_value (&reclock_checker_done, 1); - gl_thread_join (checkerthread, NULL); - check_accounts (); - } diff --git a/gnu/packages/patches/libxml2-CVE-2016-4658.patch b/gnu/packages/patches/libxml2-CVE-2016-4658.patch deleted file mode 100644 index a4e1f31fae..0000000000 --- a/gnu/packages/patches/libxml2-CVE-2016-4658.patch +++ /dev/null @@ -1,257 +0,0 @@ -Fix CVE-2016-4658: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-4658 - -Patch copied from upstream source repository: - -https://git.gnome.org/browse/libxml2/commit/?id=c1d1f7121194036608bf555f08d3062a36fd344b - -From c1d1f7121194036608bf555f08d3062a36fd344b Mon Sep 17 00:00:00 2001 -From: Nick Wellnhofer <wellnhofer@aevum.de> -Date: Tue, 28 Jun 2016 18:34:52 +0200 -Subject: [PATCH] Disallow namespace nodes in XPointer ranges - -Namespace nodes must be copied to avoid use-after-free errors. -But they don't necessarily have a physical representation in a -document, so simply disallow them in XPointer ranges. - -Found with afl-fuzz. - -Fixes CVE-2016-4658. ---- - xpointer.c | 149 +++++++++++++++++++++++-------------------------------------- - 1 file changed, 56 insertions(+), 93 deletions(-) - -diff --git a/xpointer.c b/xpointer.c -index a7b03fbd..694d120e 100644 ---- a/xpointer.c -+++ b/xpointer.c -@@ -320,6 +320,45 @@ xmlXPtrRangesEqual(xmlXPathObjectPtr range1, xmlXPathObjectPtr range2) { - } - - /** -+ * xmlXPtrNewRangeInternal: -+ * @start: the starting node -+ * @startindex: the start index -+ * @end: the ending point -+ * @endindex: the ending index -+ * -+ * Internal function to create a new xmlXPathObjectPtr of type range -+ * -+ * Returns the newly created object. -+ */ -+static xmlXPathObjectPtr -+xmlXPtrNewRangeInternal(xmlNodePtr start, int startindex, -+ xmlNodePtr end, int endindex) { -+ xmlXPathObjectPtr ret; -+ -+ /* -+ * Namespace nodes must be copied (see xmlXPathNodeSetDupNs). -+ * Disallow them for now. -+ */ -+ if ((start != NULL) && (start->type == XML_NAMESPACE_DECL)) -+ return(NULL); -+ if ((end != NULL) && (end->type == XML_NAMESPACE_DECL)) -+ return(NULL); -+ -+ ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); -+ if (ret == NULL) { -+ xmlXPtrErrMemory("allocating range"); -+ return(NULL); -+ } -+ memset(ret, 0, sizeof(xmlXPathObject)); -+ ret->type = XPATH_RANGE; -+ ret->user = start; -+ ret->index = startindex; -+ ret->user2 = end; -+ ret->index2 = endindex; -+ return(ret); -+} -+ -+/** - * xmlXPtrNewRange: - * @start: the starting node - * @startindex: the start index -@@ -344,17 +383,7 @@ xmlXPtrNewRange(xmlNodePtr start, int startindex, - if (endindex < 0) - return(NULL); - -- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); -- if (ret == NULL) { -- xmlXPtrErrMemory("allocating range"); -- return(NULL); -- } -- memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); -- ret->type = XPATH_RANGE; -- ret->user = start; -- ret->index = startindex; -- ret->user2 = end; -- ret->index2 = endindex; -+ ret = xmlXPtrNewRangeInternal(start, startindex, end, endindex); - xmlXPtrRangeCheckOrder(ret); - return(ret); - } -@@ -381,17 +410,8 @@ xmlXPtrNewRangePoints(xmlXPathObjectPtr start, xmlXPathObjectPtr end) { - if (end->type != XPATH_POINT) - return(NULL); - -- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); -- if (ret == NULL) { -- xmlXPtrErrMemory("allocating range"); -- return(NULL); -- } -- memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); -- ret->type = XPATH_RANGE; -- ret->user = start->user; -- ret->index = start->index; -- ret->user2 = end->user; -- ret->index2 = end->index; -+ ret = xmlXPtrNewRangeInternal(start->user, start->index, end->user, -+ end->index); - xmlXPtrRangeCheckOrder(ret); - return(ret); - } -@@ -416,17 +436,7 @@ xmlXPtrNewRangePointNode(xmlXPathObjectPtr start, xmlNodePtr end) { - if (start->type != XPATH_POINT) - return(NULL); - -- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); -- if (ret == NULL) { -- xmlXPtrErrMemory("allocating range"); -- return(NULL); -- } -- memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); -- ret->type = XPATH_RANGE; -- ret->user = start->user; -- ret->index = start->index; -- ret->user2 = end; -- ret->index2 = -1; -+ ret = xmlXPtrNewRangeInternal(start->user, start->index, end, -1); - xmlXPtrRangeCheckOrder(ret); - return(ret); - } -@@ -453,17 +463,7 @@ xmlXPtrNewRangeNodePoint(xmlNodePtr start, xmlXPathObjectPtr end) { - if (end->type != XPATH_POINT) - return(NULL); - -- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); -- if (ret == NULL) { -- xmlXPtrErrMemory("allocating range"); -- return(NULL); -- } -- memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); -- ret->type = XPATH_RANGE; -- ret->user = start; -- ret->index = -1; -- ret->user2 = end->user; -- ret->index2 = end->index; -+ ret = xmlXPtrNewRangeInternal(start, -1, end->user, end->index); - xmlXPtrRangeCheckOrder(ret); - return(ret); - } -@@ -486,17 +486,7 @@ xmlXPtrNewRangeNodes(xmlNodePtr start, xmlNodePtr end) { - if (end == NULL) - return(NULL); - -- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); -- if (ret == NULL) { -- xmlXPtrErrMemory("allocating range"); -- return(NULL); -- } -- memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); -- ret->type = XPATH_RANGE; -- ret->user = start; -- ret->index = -1; -- ret->user2 = end; -- ret->index2 = -1; -+ ret = xmlXPtrNewRangeInternal(start, -1, end, -1); - xmlXPtrRangeCheckOrder(ret); - return(ret); - } -@@ -516,17 +506,7 @@ xmlXPtrNewCollapsedRange(xmlNodePtr start) { - if (start == NULL) - return(NULL); - -- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); -- if (ret == NULL) { -- xmlXPtrErrMemory("allocating range"); -- return(NULL); -- } -- memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); -- ret->type = XPATH_RANGE; -- ret->user = start; -- ret->index = -1; -- ret->user2 = NULL; -- ret->index2 = -1; -+ ret = xmlXPtrNewRangeInternal(start, -1, NULL, -1); - return(ret); - } - -@@ -541,6 +521,8 @@ xmlXPtrNewCollapsedRange(xmlNodePtr start) { - */ - xmlXPathObjectPtr - xmlXPtrNewRangeNodeObject(xmlNodePtr start, xmlXPathObjectPtr end) { -+ xmlNodePtr endNode; -+ int endIndex; - xmlXPathObjectPtr ret; - - if (start == NULL) -@@ -549,7 +531,12 @@ xmlXPtrNewRangeNodeObject(xmlNodePtr start, xmlXPathObjectPtr end) { - return(NULL); - switch (end->type) { - case XPATH_POINT: -+ endNode = end->user; -+ endIndex = end->index; -+ break; - case XPATH_RANGE: -+ endNode = end->user2; -+ endIndex = end->index2; - break; - case XPATH_NODESET: - /* -@@ -557,39 +544,15 @@ xmlXPtrNewRangeNodeObject(xmlNodePtr start, xmlXPathObjectPtr end) { - */ - if (end->nodesetval->nodeNr <= 0) - return(NULL); -+ endNode = end->nodesetval->nodeTab[end->nodesetval->nodeNr - 1]; -+ endIndex = -1; - break; - default: - /* TODO */ - return(NULL); - } - -- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); -- if (ret == NULL) { -- xmlXPtrErrMemory("allocating range"); -- return(NULL); -- } -- memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); -- ret->type = XPATH_RANGE; -- ret->user = start; -- ret->index = -1; -- switch (end->type) { -- case XPATH_POINT: -- ret->user2 = end->user; -- ret->index2 = end->index; -- break; -- case XPATH_RANGE: -- ret->user2 = end->user2; -- ret->index2 = end->index2; -- break; -- case XPATH_NODESET: { -- ret->user2 = end->nodesetval->nodeTab[end->nodesetval->nodeNr - 1]; -- ret->index2 = -1; -- break; -- } -- default: -- STRANGE -- return(NULL); -- } -+ ret = xmlXPtrNewRangeInternal(start, -1, endNode, endIndex); - xmlXPtrRangeCheckOrder(ret); - return(ret); - } --- -2.11.0 - diff --git a/gnu/packages/patches/libxml2-CVE-2016-5131.patch b/gnu/packages/patches/libxml2-CVE-2016-5131.patch deleted file mode 100644 index 38938c8e3e..0000000000 --- a/gnu/packages/patches/libxml2-CVE-2016-5131.patch +++ /dev/null @@ -1,218 +0,0 @@ -Fix CVE-2016-5131: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-5131 - -Patches copied from upstream source repository (the test suite fails -without the 2nd patch): - -https://git.gnome.org/browse/libxml2/commit/?id=9ab01a277d71f54d3143c2cf333c5c2e9aaedd9e -https://git.gnome.org/browse/libxml2/commit/?id=a005199330b86dada19d162cae15ef9bdcb6baa8 - -From 9ab01a277d71f54d3143c2cf333c5c2e9aaedd9e Mon Sep 17 00:00:00 2001 -From: Nick Wellnhofer <wellnhofer@aevum.de> -Date: Tue, 28 Jun 2016 14:22:23 +0200 -Subject: [PATCH] Fix XPointer paths beginning with range-to - -The old code would invoke the broken xmlXPtrRangeToFunction. range-to -isn't really a function but a special kind of location step. Remove -this function and always handle range-to in the XPath code. - -The old xmlXPtrRangeToFunction could also be abused to trigger a -use-after-free error with the potential for remote code execution. - -Found with afl-fuzz. - -Fixes CVE-2016-5131. ---- - result/XPath/xptr/vidbase | 13 ++++++++ - test/XPath/xptr/vidbase | 1 + - xpath.c | 7 ++++- - xpointer.c | 76 ++++------------------------------------------- - 4 files changed, 26 insertions(+), 71 deletions(-) - -diff --git a/result/XPath/xptr/vidbase b/result/XPath/xptr/vidbase -index 8b9e92d6..f19193e7 100644 ---- a/result/XPath/xptr/vidbase -+++ b/result/XPath/xptr/vidbase -@@ -17,3 +17,16 @@ Object is a Location Set: - To node - ELEMENT p - -+ -+======================== -+Expression: xpointer(range-to(id('chapter2'))) -+Object is a Location Set: -+1 : Object is a range : -+ From node -+ / -+ To node -+ ELEMENT chapter -+ ATTRIBUTE id -+ TEXT -+ content=chapter2 -+ -diff --git a/test/XPath/xptr/vidbase b/test/XPath/xptr/vidbase -index b1463830..884b1065 100644 ---- a/test/XPath/xptr/vidbase -+++ b/test/XPath/xptr/vidbase -@@ -1,2 +1,3 @@ - xpointer(id('chapter1')/p) - xpointer(id('chapter1')/p[1]/range-to(following-sibling::p[2])) -+xpointer(range-to(id('chapter2'))) -diff --git a/xpath.c b/xpath.c -index d992841e..5a01b1b3 100644 ---- a/xpath.c -+++ b/xpath.c -@@ -10691,13 +10691,18 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) { - lc = 1; - break; - } else if ((NXT(len) == '(')) { -- /* Note Type or Function */ -+ /* Node Type or Function */ - if (xmlXPathIsNodeType(name)) { - #ifdef DEBUG_STEP - xmlGenericError(xmlGenericErrorContext, - "PathExpr: Type search\n"); - #endif - lc = 1; -+#ifdef LIBXML_XPTR_ENABLED -+ } else if (ctxt->xptr && -+ xmlStrEqual(name, BAD_CAST "range-to")) { -+ lc = 1; -+#endif - } else { - #ifdef DEBUG_STEP - xmlGenericError(xmlGenericErrorContext, -diff --git a/xpointer.c b/xpointer.c -index 676c5105..d74174a3 100644 ---- a/xpointer.c -+++ b/xpointer.c -@@ -1332,8 +1332,6 @@ xmlXPtrNewContext(xmlDocPtr doc, xmlNodePtr here, xmlNodePtr origin) { - ret->here = here; - ret->origin = origin; - -- xmlXPathRegisterFunc(ret, (xmlChar *)"range-to", -- xmlXPtrRangeToFunction); - xmlXPathRegisterFunc(ret, (xmlChar *)"range", - xmlXPtrRangeFunction); - xmlXPathRegisterFunc(ret, (xmlChar *)"range-inside", -@@ -2243,76 +2241,14 @@ xmlXPtrRangeInsideFunction(xmlXPathParserContextPtr ctxt, int nargs) { - * @nargs: the number of args - * - * Implement the range-to() XPointer function -+ * -+ * Obsolete. range-to is not a real function but a special type of location -+ * step which is handled in xpath.c. - */ - void --xmlXPtrRangeToFunction(xmlXPathParserContextPtr ctxt, int nargs) { -- xmlXPathObjectPtr range; -- const xmlChar *cur; -- xmlXPathObjectPtr res, obj; -- xmlXPathObjectPtr tmp; -- xmlLocationSetPtr newset = NULL; -- xmlNodeSetPtr oldset; -- int i; -- -- if (ctxt == NULL) return; -- CHECK_ARITY(1); -- /* -- * Save the expression pointer since we will have to evaluate -- * it multiple times. Initialize the new set. -- */ -- CHECK_TYPE(XPATH_NODESET); -- obj = valuePop(ctxt); -- oldset = obj->nodesetval; -- ctxt->context->node = NULL; -- -- cur = ctxt->cur; -- newset = xmlXPtrLocationSetCreate(NULL); -- -- for (i = 0; i < oldset->nodeNr; i++) { -- ctxt->cur = cur; -- -- /* -- * Run the evaluation with a node list made of a single item -- * in the nodeset. -- */ -- ctxt->context->node = oldset->nodeTab[i]; -- tmp = xmlXPathNewNodeSet(ctxt->context->node); -- valuePush(ctxt, tmp); -- -- xmlXPathEvalExpr(ctxt); -- CHECK_ERROR; -- -- /* -- * The result of the evaluation need to be tested to -- * decided whether the filter succeeded or not -- */ -- res = valuePop(ctxt); -- range = xmlXPtrNewRangeNodeObject(oldset->nodeTab[i], res); -- if (range != NULL) { -- xmlXPtrLocationSetAdd(newset, range); -- } -- -- /* -- * Cleanup -- */ -- if (res != NULL) -- xmlXPathFreeObject(res); -- if (ctxt->value == tmp) { -- res = valuePop(ctxt); -- xmlXPathFreeObject(res); -- } -- -- ctxt->context->node = NULL; -- } -- -- /* -- * The result is used as the new evaluation set. -- */ -- xmlXPathFreeObject(obj); -- ctxt->context->node = NULL; -- ctxt->context->contextSize = -1; -- ctxt->context->proximityPosition = -1; -- valuePush(ctxt, xmlXPtrWrapLocationSet(newset)); -+xmlXPtrRangeToFunction(xmlXPathParserContextPtr ctxt, -+ int nargs ATTRIBUTE_UNUSED) { -+ XP_ERROR(XPATH_EXPR_ERROR); - } - - /** --- -2.11.0 - -From a005199330b86dada19d162cae15ef9bdcb6baa8 Mon Sep 17 00:00:00 2001 -From: Nick Wellnhofer <wellnhofer@aevum.de> -Date: Tue, 28 Jun 2016 14:19:58 +0200 -Subject: [PATCH] Fix comparison with root node in xmlXPathCmpNodes - -This change has already been made in xmlXPathCmpNodesExt but not in -xmlXPathCmpNodes. ---- - xpath.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xpath.c b/xpath.c -index 751665b8..d992841e 100644 ---- a/xpath.c -+++ b/xpath.c -@@ -3342,13 +3342,13 @@ xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) { - * compute depth to root - */ - for (depth2 = 0, cur = node2;cur->parent != NULL;cur = cur->parent) { -- if (cur == node1) -+ if (cur->parent == node1) - return(1); - depth2++; - } - root = cur; - for (depth1 = 0, cur = node1;cur->parent != NULL;cur = cur->parent) { -- if (cur == node2) -+ if (cur->parent == node2) - return(-1); - depth1++; - } --- -2.11.0 - diff --git a/gnu/packages/patches/libxml2-CVE-2017-0663.patch b/gnu/packages/patches/libxml2-CVE-2017-0663.patch deleted file mode 100644 index b0277a2d23..0000000000 --- a/gnu/packages/patches/libxml2-CVE-2017-0663.patch +++ /dev/null @@ -1,53 +0,0 @@ -Fix CVE-2017-0663: - -https://bugzilla.gnome.org/show_bug.cgi?id=780228 (not yet public) -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-0663 -https://security-tracker.debian.org/tracker/CVE-2017-0663 - -Patch copied from upstream source repository: - -https://git.gnome.org/browse/libxml2/commit/?id=92b9e8c8b3787068565a1820ba575d042f9eec66 - -From 92b9e8c8b3787068565a1820ba575d042f9eec66 Mon Sep 17 00:00:00 2001 -From: Nick Wellnhofer <wellnhofer@aevum.de> -Date: Tue, 6 Jun 2017 12:56:28 +0200 -Subject: [PATCH] Fix type confusion in xmlValidateOneNamespace - -Comment out code that casts xmlNsPtr to xmlAttrPtr. ID types on -namespace declarations make no practical sense anyway. - -Fixes bug 780228. - -Found with libFuzzer and ASan. ---- - valid.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/valid.c b/valid.c -index 8075d3a0..c51ea290 100644 ---- a/valid.c -+++ b/valid.c -@@ -4627,6 +4627,12 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) { - } - } - -+ /* -+ * Casting ns to xmlAttrPtr is wrong. We'd need separate functions -+ * xmlAddID and xmlAddRef for namespace declarations, but it makes -+ * no practical sense to use ID types anyway. -+ */ -+#if 0 - /* Validity Constraint: ID uniqueness */ - if (attrDecl->atype == XML_ATTRIBUTE_ID) { - if (xmlAddID(ctxt, doc, value, (xmlAttrPtr) ns) == NULL) -@@ -4638,6 +4644,7 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) { - if (xmlAddRef(ctxt, doc, value, (xmlAttrPtr) ns) == NULL) - ret = 0; - } -+#endif - - /* Validity Constraint: Notation Attributes */ - if (attrDecl->atype == XML_ATTRIBUTE_NOTATION) { --- -2.14.1 - diff --git a/gnu/packages/patches/libxml2-CVE-2017-15412.patch b/gnu/packages/patches/libxml2-CVE-2017-15412.patch deleted file mode 100644 index 07fe190ed1..0000000000 --- a/gnu/packages/patches/libxml2-CVE-2017-15412.patch +++ /dev/null @@ -1,47 +0,0 @@ -Fix CVE-2017-15412: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-15412 -https://bugs.chromium.org/p/chromium/issues/detail?id=727039 -https://bugzilla.redhat.com/show_bug.cgi?id=1523128 -https://bugzilla.gnome.org/show_bug.cgi?id=783160 - -Patch copied from upstream source repository: - -https://git.gnome.org/browse/libxml2/commit/?id=0f3b843b3534784ef57a4f9b874238aa1fda5a73 - -From 0f3b843b3534784ef57a4f9b874238aa1fda5a73 Mon Sep 17 00:00:00 2001 -From: Nick Wellnhofer <wellnhofer@aevum.de> -Date: Thu, 1 Jun 2017 23:12:19 +0200 -Subject: [PATCH] Fix XPath stack frame logic - -Move the calls to xmlXPathSetFrame and xmlXPathPopFrame around in -xmlXPathCompOpEvalPositionalPredicate to make sure that the context -object on the stack is actually protected. Otherwise, memory corruption -can occur when calling sloppily coded XPath extension functions. - -Fixes bug 783160. ---- - xpath.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xpath.c b/xpath.c -index 94815075..b816bd36 100644 ---- a/xpath.c -+++ b/xpath.c -@@ -11932,11 +11932,11 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt, - } - } - -- frame = xmlXPathSetFrame(ctxt); - valuePush(ctxt, contextObj); -+ frame = xmlXPathSetFrame(ctxt); - res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1); -- tmp = valuePop(ctxt); - xmlXPathPopFrame(ctxt, frame); -+ tmp = valuePop(ctxt); - - if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) { - while (tmp != contextObj) { --- -2.15.1 - diff --git a/gnu/packages/patches/libxml2-CVE-2017-7375.patch b/gnu/packages/patches/libxml2-CVE-2017-7375.patch deleted file mode 100644 index 32af1ff6ba..0000000000 --- a/gnu/packages/patches/libxml2-CVE-2017-7375.patch +++ /dev/null @@ -1,45 +0,0 @@ -Fix CVE-2017-7375: - -https://bugzilla.gnome.org/show_bug.cgi?id=780691 (not yet public) -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7375 -https://security-tracker.debian.org/tracker/CVE-2017-7375 - -Patch copied from upstream source repository: - -https://git.gnome.org/browse/libxml2/commit/?id=90ccb58242866b0ba3edbef8fe44214a101c2b3e - -From 90ccb58242866b0ba3edbef8fe44214a101c2b3e Mon Sep 17 00:00:00 2001 -From: Neel Mehta <nmehta@google.com> -Date: Fri, 7 Apr 2017 17:43:02 +0200 -Subject: [PATCH] Prevent unwanted external entity reference - -For https://bugzilla.gnome.org/show_bug.cgi?id=780691 - -* parser.c: add a specific check to avoid PE reference ---- - parser.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/parser.c b/parser.c -index 609a2703..c2c812de 100644 ---- a/parser.c -+++ b/parser.c -@@ -8123,6 +8123,15 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt) - if (xmlPushInput(ctxt, input) < 0) - return; - } else { -+ if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) && -+ ((ctxt->options & XML_PARSE_NOENT) == 0) && -+ ((ctxt->options & XML_PARSE_DTDVALID) == 0) && -+ ((ctxt->options & XML_PARSE_DTDLOAD) == 0) && -+ ((ctxt->options & XML_PARSE_DTDATTR) == 0) && -+ (ctxt->replaceEntities == 0) && -+ (ctxt->validate == 0)) -+ return; -+ - /* - * TODO !!! - * handle the extra spaces added before and after --- -2.14.1 - diff --git a/gnu/packages/patches/libxml2-CVE-2017-7376.patch b/gnu/packages/patches/libxml2-CVE-2017-7376.patch deleted file mode 100644 index 5b9e45bd83..0000000000 --- a/gnu/packages/patches/libxml2-CVE-2017-7376.patch +++ /dev/null @@ -1,41 +0,0 @@ -Fix CVE-2017-7376: - -https://bugzilla.gnome.org/show_bug.cgi?id=780690 (not yet public) -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7376 -https://security-tracker.debian.org/tracker/CVE-2017-7376 - -Patch copied from upstream source repository: - -https://git.gnome.org/browse/libxml2/commit/?id=5dca9eea1bd4263bfa4d037ab2443de1cd730f7e - -From 5dca9eea1bd4263bfa4d037ab2443de1cd730f7e Mon Sep 17 00:00:00 2001 -From: Daniel Veillard <veillard@redhat.com> -Date: Fri, 7 Apr 2017 17:13:28 +0200 -Subject: [PATCH] Increase buffer space for port in HTTP redirect support - -For https://bugzilla.gnome.org/show_bug.cgi?id=780690 - -nanohttp.c: the code wrongly assumed a short int port value. ---- - nanohttp.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/nanohttp.c b/nanohttp.c -index e109ad75..373425de 100644 ---- a/nanohttp.c -+++ b/nanohttp.c -@@ -1423,9 +1423,9 @@ retry: - if (ctxt->port != 80) { - /* reserve space for ':xxxxx', incl. potential proxy */ - if (proxy) -- blen += 12; -+ blen += 17; - else -- blen += 6; -+ blen += 11; - } - bp = (char*)xmlMallocAtomic(blen); - if ( bp == NULL ) { --- -2.14.1 - diff --git a/gnu/packages/patches/libxml2-CVE-2017-9047+CVE-2017-9048.patch b/gnu/packages/patches/libxml2-CVE-2017-9047+CVE-2017-9048.patch deleted file mode 100644 index 0a0e6d34cf..0000000000 --- a/gnu/packages/patches/libxml2-CVE-2017-9047+CVE-2017-9048.patch +++ /dev/null @@ -1,130 +0,0 @@ -Fix CVE-2017-{9047,9048}: - -https://bugzilla.gnome.org/show_bug.cgi?id=781333 (not yet public) -https://bugzilla.gnome.org/show_bug.cgi?id=781701 (not yet public) -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9047 -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9048 -http://www.openwall.com/lists/oss-security/2017/05/15/1 -https://security-tracker.debian.org/tracker/CVE-2017-9047 -https://security-tracker.debian.org/tracker/CVE-2017-9048 - -Patch copied from upstream source repository: - -https://git.gnome.org/browse/libxml2/commit/?id=932cc9896ab41475d4aa429c27d9afd175959d74 - -From 932cc9896ab41475d4aa429c27d9afd175959d74 Mon Sep 17 00:00:00 2001 -From: Nick Wellnhofer <wellnhofer@aevum.de> -Date: Sat, 3 Jun 2017 02:01:29 +0200 -Subject: [PATCH] Fix buffer size checks in xmlSnprintfElementContent -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -xmlSnprintfElementContent failed to correctly check the available -buffer space in two locations. - -Fixes bug 781333 (CVE-2017-9047) and bug 781701 (CVE-2017-9048). - -Thanks to Marcel Böhme and Thuan Pham for the report. ---- - result/valid/781333.xml | 5 +++++ - result/valid/781333.xml.err | 3 +++ - result/valid/781333.xml.err.rdr | 6 ++++++ - test/valid/781333.xml | 4 ++++ - valid.c | 20 +++++++++++--------- - 5 files changed, 29 insertions(+), 9 deletions(-) - create mode 100644 result/valid/781333.xml - create mode 100644 result/valid/781333.xml.err - create mode 100644 result/valid/781333.xml.err.rdr - create mode 100644 test/valid/781333.xml - -diff --git a/result/valid/781333.xml b/result/valid/781333.xml -new file mode 100644 -index 00000000..45dc451d ---- /dev/null -+++ b/result/valid/781333.xml -@@ -0,0 +1,5 @@ -+<?xml version="1.0"?> -+<!DOCTYPE a [ -+<!ELEMENT a (pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp:llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll)> -+]> -+<a/> -diff --git a/result/valid/781333.xml.err b/result/valid/781333.xml.err -new file mode 100644 -index 00000000..b401b49a ---- /dev/null -+++ b/result/valid/781333.xml.err -@@ -0,0 +1,3 @@ -+./test/valid/781333.xml:4: element a: validity error : Element a content does not follow the DTD, expecting ( ..., got -+<a/> -+ ^ -diff --git a/result/valid/781333.xml.err.rdr b/result/valid/781333.xml.err.rdr -new file mode 100644 -index 00000000..5ff56992 ---- /dev/null -+++ b/result/valid/781333.xml.err.rdr -@@ -0,0 +1,6 @@ -+./test/valid/781333.xml:4: element a: validity error : Element a content does not follow the DTD, expecting ( ..., got -+<a/> -+ ^ -+./test/valid/781333.xml:5: element a: validity error : Element a content does not follow the DTD, Expecting more child -+ -+^ -diff --git a/test/valid/781333.xml b/test/valid/781333.xml -new file mode 100644 -index 00000000..b29e5a68 ---- /dev/null -+++ b/test/valid/781333.xml -@@ -0,0 +1,4 @@ -+<!DOCTYPE a [ -+ <!ELEMENT a (pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp:llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll)> -+]> -+<a/> -diff --git a/valid.c b/valid.c -index 19f84b82..9b2df56a 100644 ---- a/valid.c -+++ b/valid.c -@@ -1262,22 +1262,23 @@ xmlSnprintfElementContent(char *buf, int size, xmlElementContentPtr content, int - case XML_ELEMENT_CONTENT_PCDATA: - strcat(buf, "#PCDATA"); - break; -- case XML_ELEMENT_CONTENT_ELEMENT: -+ case XML_ELEMENT_CONTENT_ELEMENT: { -+ int qnameLen = xmlStrlen(content->name); -+ -+ if (content->prefix != NULL) -+ qnameLen += xmlStrlen(content->prefix) + 1; -+ if (size - len < qnameLen + 10) { -+ strcat(buf, " ..."); -+ return; -+ } - if (content->prefix != NULL) { -- if (size - len < xmlStrlen(content->prefix) + 10) { -- strcat(buf, " ..."); -- return; -- } - strcat(buf, (char *) content->prefix); - strcat(buf, ":"); - } -- if (size - len < xmlStrlen(content->name) + 10) { -- strcat(buf, " ..."); -- return; -- } - if (content->name != NULL) - strcat(buf, (char *) content->name); - break; -+ } - case XML_ELEMENT_CONTENT_SEQ: - if ((content->c1->type == XML_ELEMENT_CONTENT_OR) || - (content->c1->type == XML_ELEMENT_CONTENT_SEQ)) -@@ -1319,6 +1320,7 @@ xmlSnprintfElementContent(char *buf, int size, xmlElementContentPtr content, int - xmlSnprintfElementContent(buf, size, content->c2, 0); - break; - } -+ if (size - strlen(buf) <= 2) return; - if (englob) - strcat(buf, ")"); - switch (content->ocur) { --- -2.14.1 - diff --git a/gnu/packages/patches/libxml2-CVE-2017-9049+CVE-2017-9050.patch b/gnu/packages/patches/libxml2-CVE-2017-9049+CVE-2017-9050.patch deleted file mode 100644 index 890e9c2284..0000000000 --- a/gnu/packages/patches/libxml2-CVE-2017-9049+CVE-2017-9050.patch +++ /dev/null @@ -1,319 +0,0 @@ -Fix CVE-2017-{9049,9050}: - -https://bugzilla.gnome.org/show_bug.cgi?id=781205 (not yet public) -https://bugzilla.gnome.org/show_bug.cgi?id=781361 (not yet public) -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9049 -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9050 -http://www.openwall.com/lists/oss-security/2017/05/15/1 -https://security-tracker.debian.org/tracker/CVE-2017-9049 -https://security-tracker.debian.org/tracker/CVE-2017-9050 - -Patch copied from upstream source repository: - -https://git.gnome.org/browse/libxml2/commit/?id=e26630548e7d138d2c560844c43820b6767251e3 - -Changes to 'runtest.c' are removed since they introduce test failure -when applying to libxml2 2.9.4 release tarball. - -From e26630548e7d138d2c560844c43820b6767251e3 Mon Sep 17 00:00:00 2001 -From: Nick Wellnhofer <wellnhofer@aevum.de> -Date: Mon, 5 Jun 2017 15:37:17 +0200 -Subject: [PATCH] Fix handling of parameter-entity references -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -There were two bugs where parameter-entity references could lead to an -unexpected change of the input buffer in xmlParseNameComplex and -xmlDictLookup being called with an invalid pointer. - -Percent sign in DTD Names -========================= - -The NEXTL macro used to call xmlParserHandlePEReference. When parsing -"complex" names inside the DTD, this could result in entity expansion -which created a new input buffer. The fix is to simply remove the call -to xmlParserHandlePEReference from the NEXTL macro. This is safe because -no users of the macro require expansion of parameter entities. - -- xmlParseNameComplex -- xmlParseNCNameComplex -- xmlParseNmtoken - -The percent sign is not allowed in names, which are grammatical tokens. - -- xmlParseEntityValue - -Parameter-entity references in entity values are expanded but this -happens in a separate step in this function. - -- xmlParseSystemLiteral - -Parameter-entity references are ignored in the system literal. - -- xmlParseAttValueComplex -- xmlParseCharDataComplex -- xmlParseCommentComplex -- xmlParsePI -- xmlParseCDSect - -Parameter-entity references are ignored outside the DTD. - -- xmlLoadEntityContent - -This function is only called from xmlStringLenDecodeEntities and -entities are replaced in a separate step immediately after the function -call. - -This bug could also be triggered with an internal subset and double -entity expansion. - -This fixes bug 766956 initially reported by Wei Lei and independently by -Chromium's ClusterFuzz, Hanno Böck, and Marco Grassi. Thanks to everyone -involved. - -xmlParseNameComplex with XML_PARSE_OLD10 -======================================== - -When parsing Names inside an expanded parameter entity with the -XML_PARSE_OLD10 option, xmlParseNameComplex would call xmlGROW via the -GROW macro if the input buffer was exhausted. At the end of the -parameter entity's replacement text, this function would then call -xmlPopInput which invalidated the input buffer. - -There should be no need to invoke GROW in this situation because the -buffer is grown periodically every XML_PARSER_CHUNK_SIZE characters and, -at least for UTF-8, in xmlCurrentChar. This also matches the code path -executed when XML_PARSE_OLD10 is not set. - -This fixes bugs 781205 (CVE-2017-9049) and 781361 (CVE-2017-9050). -Thanks to Marcel Böhme and Thuan Pham for the report. - -Additional hardening -==================== - -A separate check was added in xmlParseNameComplex to validate the -buffer size. ---- - Makefile.am | 18 ++++++++++++++++++ - parser.c | 18 ++++++++++-------- - result/errors10/781205.xml | 0 - result/errors10/781205.xml.err | 21 +++++++++++++++++++++ - result/errors10/781361.xml | 0 - result/errors10/781361.xml.err | 13 +++++++++++++ - result/valid/766956.xml | 0 - result/valid/766956.xml.err | 9 +++++++++ - result/valid/766956.xml.err.rdr | 10 ++++++++++ - runtest.c | 3 +++ - test/errors10/781205.xml | 3 +++ - test/errors10/781361.xml | 3 +++ - test/valid/766956.xml | 2 ++ - test/valid/dtds/766956.dtd | 2 ++ - 14 files changed, 94 insertions(+), 8 deletions(-) - create mode 100644 result/errors10/781205.xml - create mode 100644 result/errors10/781205.xml.err - create mode 100644 result/errors10/781361.xml - create mode 100644 result/errors10/781361.xml.err - create mode 100644 result/valid/766956.xml - create mode 100644 result/valid/766956.xml.err - create mode 100644 result/valid/766956.xml.err.rdr - create mode 100644 test/errors10/781205.xml - create mode 100644 test/errors10/781361.xml - create mode 100644 test/valid/766956.xml - create mode 100644 test/valid/dtds/766956.dtd - -diff --git a/Makefile.am b/Makefile.am -index 6fc8ffa9..10e716a5 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -427,6 +427,24 @@ Errtests : xmllint$(EXEEXT) - if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) -+ @echo "## Error cases regression tests (old 1.0)" -+ -@(for i in $(srcdir)/test/errors10/*.xml ; do \ -+ name=`basename $$i`; \ -+ if [ ! -d $$i ] ; then \ -+ if [ ! -f $(srcdir)/result/errors10/$$name ] ; then \ -+ echo New test file $$name ; \ -+ $(CHECKER) $(top_builddir)/xmllint --oldxml10 $$i \ -+ 2> $(srcdir)/result/errors10/$$name.err \ -+ > $(srcdir)/result/errors10/$$name ; \ -+ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ -+ else \ -+ log=`$(CHECKER) $(top_builddir)/xmllint --oldxml10 $$i 2> error.$$name > result.$$name ; \ -+ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ -+ diff $(srcdir)/result/errors10/$$name result.$$name ; \ -+ diff $(srcdir)/result/errors10/$$name.err error.$$name` ; \ -+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \ -+ rm result.$$name error.$$name ; \ -+ fi ; fi ; done) - @echo "## Error cases stream regression tests" - -@(for i in $(srcdir)/test/errors/*.xml ; do \ - name=`basename $$i`; \ -diff --git a/parser.c b/parser.c -index df2efa55..a175ac4e 100644 ---- a/parser.c -+++ b/parser.c -@@ -2121,7 +2121,6 @@ static void xmlGROW (xmlParserCtxtPtr ctxt) { - ctxt->input->line++; ctxt->input->col = 1; \ - } else ctxt->input->col++; \ - ctxt->input->cur += l; \ -- if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \ - } while (0) - - #define CUR_CHAR(l) xmlCurrentChar(ctxt, &l) -@@ -3412,13 +3411,6 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) { - len += l; - NEXTL(l); - c = CUR_CHAR(l); -- if (c == 0) { -- count = 0; -- GROW; -- if (ctxt->instate == XML_PARSER_EOF) -- return(NULL); -- c = CUR_CHAR(l); -- } - } - } - if ((len > XML_MAX_NAME_LENGTH) && -@@ -3426,6 +3418,16 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) { - xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Name"); - return(NULL); - } -+ if (ctxt->input->cur - ctxt->input->base < len) { -+ /* -+ * There were a couple of bugs where PERefs lead to to a change -+ * of the buffer. Check the buffer size to avoid passing an invalid -+ * pointer to xmlDictLookup. -+ */ -+ xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, -+ "unexpected change of input buffer"); -+ return (NULL); -+ } - if ((*ctxt->input->cur == '\n') && (ctxt->input->cur[-1] == '\r')) - return(xmlDictLookup(ctxt->dict, ctxt->input->cur - (len + 1), len)); - return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); -diff --git a/result/errors10/781205.xml b/result/errors10/781205.xml -new file mode 100644 -index 00000000..e69de29b -diff --git a/result/errors10/781205.xml.err b/result/errors10/781205.xml.err -new file mode 100644 -index 00000000..da15c3f7 ---- /dev/null -+++ b/result/errors10/781205.xml.err -@@ -0,0 +1,21 @@ -+Entity: line 1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration -+ -+ %a; -+ ^ -+Entity: line 1: -+<:0000 -+^ -+Entity: line 1: parser error : DOCTYPE improperly terminated -+ %a; -+ ^ -+Entity: line 1: -+<:0000 -+^ -+namespace error : Failed to parse QName ':0000' -+ %a; -+ ^ -+<:0000 -+ ^ -+./test/errors10/781205.xml:4: parser error : Couldn't find end of Start Tag :0000 line 1 -+ -+^ -diff --git a/result/errors10/781361.xml b/result/errors10/781361.xml -new file mode 100644 -index 00000000..e69de29b -diff --git a/result/errors10/781361.xml.err b/result/errors10/781361.xml.err -new file mode 100644 -index 00000000..655f41a2 ---- /dev/null -+++ b/result/errors10/781361.xml.err -@@ -0,0 +1,13 @@ -+./test/errors10/781361.xml:4: parser error : xmlParseElementDecl: 'EMPTY', 'ANY' or '(' expected -+ -+^ -+./test/errors10/781361.xml:4: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration -+ -+ -+^ -+./test/errors10/781361.xml:4: parser error : DOCTYPE improperly terminated -+ -+^ -+./test/errors10/781361.xml:4: parser error : Start tag expected, '<' not found -+ -+^ -diff --git a/result/valid/766956.xml b/result/valid/766956.xml -new file mode 100644 -index 00000000..e69de29b -diff --git a/result/valid/766956.xml.err b/result/valid/766956.xml.err -new file mode 100644 -index 00000000..34b1dae6 ---- /dev/null -+++ b/result/valid/766956.xml.err -@@ -0,0 +1,9 @@ -+test/valid/dtds/766956.dtd:2: parser error : PEReference: expecting ';' -+%ä%ent; -+ ^ -+Entity: line 1: parser error : Content error in the external subset -+ %ent; -+ ^ -+Entity: line 1: -+value -+^ -diff --git a/result/valid/766956.xml.err.rdr b/result/valid/766956.xml.err.rdr -new file mode 100644 -index 00000000..77603462 ---- /dev/null -+++ b/result/valid/766956.xml.err.rdr -@@ -0,0 +1,10 @@ -+test/valid/dtds/766956.dtd:2: parser error : PEReference: expecting ';' -+%ä%ent; -+ ^ -+Entity: line 1: parser error : Content error in the external subset -+ %ent; -+ ^ -+Entity: line 1: -+value -+^ -+./test/valid/766956.xml : failed to parse -diff --git a/test/errors10/781205.xml b/test/errors10/781205.xml -new file mode 100644 -index 00000000..d9e9e839 ---- /dev/null -+++ b/test/errors10/781205.xml -@@ -0,0 +1,3 @@ -+<!DOCTYPE D [ -+ <!ENTITY % a "<:0000"> -+ %a; -diff --git a/test/errors10/781361.xml b/test/errors10/781361.xml -new file mode 100644 -index 00000000..67476bcb ---- /dev/null -+++ b/test/errors10/781361.xml -@@ -0,0 +1,3 @@ -+<!DOCTYPE doc [ -+ <!ENTITY % elem "<!ELEMENT e0000000000"> -+ %elem; -diff --git a/test/valid/766956.xml b/test/valid/766956.xml -new file mode 100644 -index 00000000..19a95a0e ---- /dev/null -+++ b/test/valid/766956.xml -@@ -0,0 +1,2 @@ -+<!DOCTYPE test SYSTEM "dtds/766956.dtd"> -+<test/> -diff --git a/test/valid/dtds/766956.dtd b/test/valid/dtds/766956.dtd -new file mode 100644 -index 00000000..dddde68b ---- /dev/null -+++ b/test/valid/dtds/766956.dtd -@@ -0,0 +1,2 @@ -+<!ENTITY % ent "value"> -+%ä%ent; --- -2.14.1 - diff --git a/gnu/packages/patches/libxslt-CVE-2016-4738.patch b/gnu/packages/patches/libxslt-CVE-2016-4738.patch deleted file mode 100644 index a7537c66ca..0000000000 --- a/gnu/packages/patches/libxslt-CVE-2016-4738.patch +++ /dev/null @@ -1,39 +0,0 @@ -Fix CVE-2016-4738: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-4738 -https://bugs.chromium.org/p/chromium/issues/detail?id=619006 - -Patch copied from upstream source repository: -https://git.gnome.org/browse/libxslt/commit/?id=eb1030de31165b68487f288308f9d1810fed6880 - -From eb1030de31165b68487f288308f9d1810fed6880 Mon Sep 17 00:00:00 2001 -From: Nick Wellnhofer <wellnhofer@aevum.de> -Date: Fri, 10 Jun 2016 14:23:58 +0200 -Subject: [PATCH] Fix heap overread in xsltFormatNumberConversion - -An empty decimal-separator could cause a heap overread. This can be -exploited to leak a couple of bytes after the buffer that holds the -pattern string. - -Found with afl-fuzz and ASan. ---- - libxslt/numbers.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/libxslt/numbers.c b/libxslt/numbers.c -index d1549b4..e78c46b 100644 ---- a/libxslt/numbers.c -+++ b/libxslt/numbers.c -@@ -1090,7 +1090,8 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, - } - - /* We have finished the integer part, now work on fraction */ -- if (xsltUTF8Charcmp(the_format, self->decimalPoint) == 0) { -+ if ( (*the_format != 0) && -+ (xsltUTF8Charcmp(the_format, self->decimalPoint) == 0) ) { - format_info.add_decimal = TRUE; - the_format += xsltUTF8Size(the_format); /* Skip over the decimal */ - } --- -2.10.2 - diff --git a/gnu/packages/patches/libxslt-CVE-2017-5029.patch b/gnu/packages/patches/libxslt-CVE-2017-5029.patch deleted file mode 100644 index cd86928b21..0000000000 --- a/gnu/packages/patches/libxslt-CVE-2017-5029.patch +++ /dev/null @@ -1,82 +0,0 @@ -Fix CVE-2017-5029: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-5029 - -Patch copied from upstream source repository: - -https://git.gnome.org/browse/libxslt/commit/?id=08ab2774b870de1c7b5a48693df75e8154addae5 - -From 08ab2774b870de1c7b5a48693df75e8154addae5 Mon Sep 17 00:00:00 2001 -From: Nick Wellnhofer <wellnhofer@aevum.de> -Date: Thu, 12 Jan 2017 15:39:52 +0100 -Subject: [PATCH] Check for integer overflow in xsltAddTextString - -Limit buffer size in xsltAddTextString to INT_MAX. The issue can be -exploited to trigger an out of bounds write on 64-bit systems. - -Originally reported to Chromium: - -https://crbug.com/676623 ---- - libxslt/transform.c | 25 ++++++++++++++++++++++--- - libxslt/xsltInternals.h | 4 ++-- - 2 files changed, 24 insertions(+), 5 deletions(-) - -diff --git a/libxslt/transform.c b/libxslt/transform.c -index 519133fc..02bff34a 100644 ---- a/libxslt/transform.c -+++ b/libxslt/transform.c -@@ -813,13 +813,32 @@ xsltAddTextString(xsltTransformContextPtr ctxt, xmlNodePtr target, - return(target); - - if (ctxt->lasttext == target->content) { -+ int minSize; - -- if (ctxt->lasttuse + len >= ctxt->lasttsize) { -+ /* Check for integer overflow accounting for NUL terminator. */ -+ if (len >= INT_MAX - ctxt->lasttuse) { -+ xsltTransformError(ctxt, NULL, target, -+ "xsltCopyText: text allocation failed\n"); -+ return(NULL); -+ } -+ minSize = ctxt->lasttuse + len + 1; -+ -+ if (ctxt->lasttsize < minSize) { - xmlChar *newbuf; - int size; -+ int extra; -+ -+ /* Double buffer size but increase by at least 100 bytes. */ -+ extra = minSize < 100 ? 100 : minSize; -+ -+ /* Check for integer overflow. */ -+ if (extra > INT_MAX - ctxt->lasttsize) { -+ size = INT_MAX; -+ } -+ else { -+ size = ctxt->lasttsize + extra; -+ } - -- size = ctxt->lasttsize + len + 100; -- size *= 2; - newbuf = (xmlChar *) xmlRealloc(target->content,size); - if (newbuf == NULL) { - xsltTransformError(ctxt, NULL, target, -diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h -index 060b1783..5ad17719 100644 ---- a/libxslt/xsltInternals.h -+++ b/libxslt/xsltInternals.h -@@ -1754,8 +1754,8 @@ struct _xsltTransformContext { - * Speed optimization when coalescing text nodes - */ - const xmlChar *lasttext; /* last text node content */ -- unsigned int lasttsize; /* last text node size */ -- unsigned int lasttuse; /* last text node use */ -+ int lasttsize; /* last text node size */ -+ int lasttuse; /* last text node use */ - /* - * Per Context Debugging - */ --- -2.15.1 - diff --git a/gnu/packages/patches/ncurses-CVE-2017-10684-10685.patch b/gnu/packages/patches/ncurses-CVE-2017-10684-10685.patch deleted file mode 100644 index 1f1b26801d..0000000000 --- a/gnu/packages/patches/ncurses-CVE-2017-10684-10685.patch +++ /dev/null @@ -1,200 +0,0 @@ -Fix CVE-2017-10684 and CVE-2017-10685: - -http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-10684 -http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-10685 - -Bug reports included proof of concept reproducer inputs: - -https://bugzilla.redhat.com/show_bug.cgi?id=1464684 -https://bugzilla.redhat.com/show_bug.cgi?id=1464685 -https://bugzilla.redhat.com/show_bug.cgi?id=1464686 -https://bugzilla.redhat.com/show_bug.cgi?id=1464687 -https://bugzilla.redhat.com/show_bug.cgi?id=1464688 -https://bugzilla.redhat.com/show_bug.cgi?id=1464691 -https://bugzilla.redhat.com/show_bug.cgi?id=1464692 - -Patches copied from ncurses patch release 20170701: - -ftp://invisible-island.net/ncurses/6.0/ncurses-6.0-20170701.patch.gz - -Excerpt from patch release announcement: - - + add/improve checks in tic's parser to address invalid input - (Redhat #1464684, #1464685, #1464686, #1464691). - + alloc_entry.c, add a check for a null-pointer. - + parse_entry.c, add several checks for valid pointers as well as - one check to ensure that a single character on a line is not - treated as the 2-character termcap short-name. - + the fixes for Redhat #1464685 obscured a problem subsequently - reported in Redhat #1464687; the given test-case was no longer - reproducible. Testing without the fixes for the earlier reports - showed a problem with buffer overflow in dump_entry.c, which is - addressed by reducing the use of a fixed-size buffer. - -https://lists.gnu.org/archive/html/bug-ncurses/2017-07/msg00001.html - ---- ncurses-6.0-20170624+/ncurses/tinfo/alloc_entry.c 2017-04-09 23:33:51.000000000 +0000 -+++ ncurses-6.0-20170701/ncurses/tinfo/alloc_entry.c 2017-06-27 23:48:55.000000000 +0000 -@@ -96,7 +96,11 @@ - { - char *result = 0; - size_t old_next_free = next_free; -- size_t len = strlen(string) + 1; -+ size_t len; -+ -+ if (string == 0) -+ return _nc_save_str(""); -+ len = strlen(string) + 1; - - if (len == 1 && next_free != 0) { - /* ---- ncurses-6.0-20170624+/ncurses/tinfo/parse_entry.c 2017-06-24 22:59:46.000000000 +0000 -+++ ncurses-6.0-20170701/ncurses/tinfo/parse_entry.c 2017-06-28 00:53:12.000000000 +0000 -@@ -236,13 +236,14 @@ - * implemented it. Note that the resulting terminal type was never the - * 2-character name, but was instead the first alias after that. - */ -+#define ok_TC2(s) (isgraph(UChar(s)) && (s) != '|') - ptr = _nc_curr_token.tk_name; - if (_nc_syntax == SYN_TERMCAP - #if NCURSES_XNAMES - && !_nc_user_definable - #endif - ) { -- if (ptr[2] == '|') { -+ if (ok_TC2(ptr[0]) && ok_TC2(ptr[1]) && (ptr[2] == '|')) { - ptr += 3; - _nc_curr_token.tk_name[2] = '\0'; - } -@@ -284,9 +285,11 @@ - if (is_use || is_tc) { - entryp->uses[entryp->nuses].name = _nc_save_str(_nc_curr_token.tk_valstring); - entryp->uses[entryp->nuses].line = _nc_curr_line; -- entryp->nuses++; -- if (entryp->nuses > 1 && is_tc) { -- BAD_TC_USAGE -+ if (VALID_STRING(entryp->uses[entryp->nuses].name)) { -+ entryp->nuses++; -+ if (entryp->nuses > 1 && is_tc) { -+ BAD_TC_USAGE -+ } - } - } else { - /* normal token lookup */ -@@ -588,7 +591,7 @@ - static void - append_acs(string_desc * dst, int code, char *src) - { -- if (src != 0 && strlen(src) == 1) { -+ if (VALID_STRING(src) && strlen(src) == 1) { - append_acs0(dst, code, *src); - } - } -@@ -849,15 +852,14 @@ - } - - if (tp->Strings[to_ptr->nte_index]) { -+ const char *s = tp->Strings[from_ptr->nte_index]; -+ const char *t = tp->Strings[to_ptr->nte_index]; - /* There's no point in warning about it if it's the same - * string; that's just an inefficiency. - */ -- if (strcmp( -- tp->Strings[from_ptr->nte_index], -- tp->Strings[to_ptr->nte_index]) != 0) -+ if (VALID_STRING(s) && VALID_STRING(t) && strcmp(s, t) != 0) - _nc_warning("%s (%s) already has an explicit value %s, ignoring ko", -- ap->to, ap->from, -- _nc_visbuf(tp->Strings[to_ptr->nte_index])); -+ ap->to, ap->from, t); - continue; - } - ---- ncurses-6.0-20170624+/progs/dump_entry.c 2017-06-23 22:47:43.000000000 +0000 -+++ ncurses-6.0-20170701/progs/dump_entry.c 2017-07-01 11:27:29.000000000 +0000 -@@ -841,9 +841,10 @@ - PredIdx num_strings = 0; - bool outcount = 0; - --#define WRAP_CONCAT \ -- wrap_concat(buffer); \ -- outcount = TRUE -+#define WRAP_CONCAT1(s) wrap_concat(s); outcount = TRUE -+#define WRAP_CONCAT2(a,b) wrap_concat(a); WRAP_CONCAT1(b) -+#define WRAP_CONCAT3(a,b,c) wrap_concat(a); WRAP_CONCAT2(b,c) -+#define WRAP_CONCAT WRAP_CONCAT1(buffer) - - len = 12; /* terminfo file-header */ - -@@ -1007,9 +1008,9 @@ - set_attributes = save_sgr; - - trimmed_sgr0 = _nc_trim_sgr0(tterm); -- if (strcmp(capability, trimmed_sgr0)) -+ if (strcmp(capability, trimmed_sgr0)) { - capability = trimmed_sgr0; -- else { -+ } else { - if (trimmed_sgr0 != exit_attribute_mode) - free(trimmed_sgr0); - } -@@ -1046,13 +1047,21 @@ - _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) - "%s=!!! %s WILL NOT CONVERT !!!", - name, srccap); -+ WRAP_CONCAT; - } else if (suppress_untranslatable) { - continue; - } else { - char *s = srccap, *d = buffer; -- _nc_SPRINTF(d, _nc_SLIMIT(sizeof(buffer)) "..%s=", name); -- d += strlen(d); -+ WRAP_CONCAT3("..", name, "="); - while ((*d = *s++) != 0) { -+ if ((d - buffer - 1) >= (int) sizeof(buffer)) { -+ fprintf(stderr, -+ "%s: value for %s is too long\n", -+ _nc_progname, -+ name); -+ *d = '\0'; -+ break; -+ } - if (*d == ':') { - *d++ = '\\'; - *d = ':'; -@@ -1061,13 +1070,12 @@ - } - d++; - } -+ WRAP_CONCAT; - } - } else { -- _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) -- "%s=%s", name, cv); -+ WRAP_CONCAT3(name, "=", cv); - } - len += (int) strlen(capability) + 1; -- WRAP_CONCAT; - } else { - char *src = _nc_tic_expand(capability, - outform == F_TERMINFO, numbers); -@@ -1083,8 +1091,7 @@ - strcpy_DYN(&tmpbuf, src); - } - len += (int) strlen(capability) + 1; -- wrap_concat(tmpbuf.text); -- outcount = TRUE; -+ WRAP_CONCAT1(tmpbuf.text); - } - } - /* e.g., trimmed_sgr0 */ -@@ -1526,7 +1533,8 @@ - } - if (len > critlen) { - (void) fprintf(stderr, -- "warning: %s entry is %d bytes long\n", -+ "%s: %s entry is %d bytes long\n", -+ _nc_progname, - _nc_first_name(tterm->term_names), - len); - SHOW_WHY("# WARNING: this entry, %d bytes long, may core-dump %s libraries!\n", diff --git a/gnu/packages/patches/nfs-utils-missing-headers.patch b/gnu/packages/patches/nfs-utils-missing-headers.patch new file mode 100644 index 0000000000..7f0542836e --- /dev/null +++ b/gnu/packages/patches/nfs-utils-missing-headers.patch @@ -0,0 +1,19 @@ +Fix compilation failure with glibc 2.26 caused by missing type +declarations: + +------ +rpc.c: In function ‘nsm_recv_getport’: +rpc.c:469:13: error: ‘UINT16_MAX’ undeclared (first use in this function) + if (port > UINT16_MAX) { +------ + +--- a/support/nsm/rpc.c.orig 2016-08-03 20:25:15.000000000 +0200 ++++ b/support/nsm/rpc.c 2017-08-26 07:41:11.884000000 +0200 +@@ -40,6 +40,7 @@ + + #include <time.h> + #include <stdbool.h> ++#include <stdint.h> + #include <string.h> + #include <unistd.h> + #include <fcntl.h> diff --git a/gnu/packages/patches/node-test-http2-server-rst-stream.patch b/gnu/packages/patches/node-test-http2-server-rst-stream.patch deleted file mode 100644 index c2f85010b1..0000000000 --- a/gnu/packages/patches/node-test-http2-server-rst-stream.patch +++ /dev/null @@ -1,131 +0,0 @@ -From a41cc020fd6e40b358103425edfa50e6a10fc973 Mon Sep 17 00:00:00 2001 -From: Anatoli Papirovski <apapirovski@mac.com> -Date: Thu, 2 Nov 2017 12:46:31 -0400 -Subject: [PATCH] test: fix flaky test-http2-server-rst-stream.js - -PR-URL: https://github.com/nodejs/node/pull/16690 -Fixes: https://github.com/nodejs/node/issues/16688 -Reviewed-By: James M Snell <jasnell@gmail.com> -Reviewed-By: Matteo Collina <matteo.collina@gmail.com> ---- - test/parallel/test-http2-server-rst-stream.js | 93 ++++++++++----------------- - 1 file changed, 35 insertions(+), 58 deletions(-) - -diff --git a/test/parallel/test-http2-server-rst-stream.js b/test/parallel/test-http2-server-rst-stream.js -index b92217dc99..dd38efb42f 100644 ---- a/test/parallel/test-http2-server-rst-stream.js -+++ b/test/parallel/test-http2-server-rst-stream.js -@@ -5,11 +5,9 @@ if (!common.hasCrypto) - common.skip('missing crypto'); - const assert = require('assert'); - const http2 = require('http2'); -+const Countdown = require('../common/countdown'); - - const { -- HTTP2_HEADER_METHOD, -- HTTP2_HEADER_PATH, -- HTTP2_METHOD_POST, - NGHTTP2_CANCEL, - NGHTTP2_NO_ERROR, - NGHTTP2_PROTOCOL_ERROR, -@@ -17,63 +15,42 @@ const { - NGHTTP2_INTERNAL_ERROR - } = http2.constants; - --const errCheck = common.expectsError({ code: 'ERR_HTTP2_STREAM_ERROR' }, 6); -+const tests = [ -+ ['rstStream', NGHTTP2_NO_ERROR, false], -+ ['rstWithNoError', NGHTTP2_NO_ERROR, false], -+ ['rstWithProtocolError', NGHTTP2_PROTOCOL_ERROR, true], -+ ['rstWithCancel', NGHTTP2_CANCEL, false], -+ ['rstWithRefuse', NGHTTP2_REFUSED_STREAM, true], -+ ['rstWithInternalError', NGHTTP2_INTERNAL_ERROR, true] -+]; -+ -+const server = http2.createServer(); -+server.on('stream', (stream, headers) => { -+ const method = headers['rstmethod']; -+ stream[method](); -+}); -+ -+server.listen(0, common.mustCall(() => { -+ const client = http2.connect(`http://localhost:${server.address().port}`); -+ -+ const countdown = new Countdown(tests.length, common.mustCall(() => { -+ client.destroy(); -+ server.close(); -+ })); - --function checkRstCode(rstMethod, expectRstCode) { -- const server = http2.createServer(); -- server.on('stream', (stream, headers, flags) => { -- stream.respond({ -- 'content-type': 'text/html', -- ':status': 200 -+ tests.forEach((test) => { -+ const req = client.request({ -+ ':method': 'POST', -+ rstmethod: test[0] - }); -- stream.write('test'); -- if (rstMethod === 'rstStream') -- stream[rstMethod](expectRstCode); -- else -- stream[rstMethod](); -- -- if (expectRstCode !== NGHTTP2_NO_ERROR && -- expectRstCode !== NGHTTP2_CANCEL) { -- stream.on('error', common.mustCall(errCheck)); -- } else { -- stream.on('error', common.mustNotCall()); -- } -- }); -- -- server.listen(0, common.mustCall(() => { -- const port = server.address().port; -- const client = http2.connect(`http://localhost:${port}`); -- -- const headers = { -- [HTTP2_HEADER_PATH]: '/', -- [HTTP2_HEADER_METHOD]: HTTP2_METHOD_POST -- }; -- const req = client.request(headers); -- -- req.setEncoding('utf8'); -- req.on('streamClosed', common.mustCall((actualRstCode) => { -- assert.strictEqual( -- expectRstCode, actualRstCode, `${rstMethod} is not match rstCode`); -- server.close(); -- client.destroy(); -+ req.on('streamClosed', common.mustCall((code) => { -+ assert.strictEqual(code, test[1]); -+ countdown.dec(); - })); -- req.on('data', common.mustCall()); - req.on('aborted', common.mustCall()); -- req.on('end', common.mustCall()); -- -- if (expectRstCode !== NGHTTP2_NO_ERROR && -- expectRstCode !== NGHTTP2_CANCEL) { -- req.on('error', common.mustCall(errCheck)); -- } else { -+ if (test[2]) -+ req.on('error', common.mustCall()); -+ else - req.on('error', common.mustNotCall()); -- } -- -- })); --} -- --checkRstCode('rstStream', NGHTTP2_NO_ERROR); --checkRstCode('rstWithNoError', NGHTTP2_NO_ERROR); --checkRstCode('rstWithProtocolError', NGHTTP2_PROTOCOL_ERROR); --checkRstCode('rstWithCancel', NGHTTP2_CANCEL); --checkRstCode('rstWithRefuse', NGHTTP2_REFUSED_STREAM); --checkRstCode('rstWithInternalError', NGHTTP2_INTERNAL_ERROR); -+ }); -+})); --- -2.15.0 - diff --git a/gnu/packages/patches/opencascade-oce-glibc-2.26.patch b/gnu/packages/patches/opencascade-oce-glibc-2.26.patch new file mode 100644 index 0000000000..ee5ed572c8 --- /dev/null +++ b/gnu/packages/patches/opencascade-oce-glibc-2.26.patch @@ -0,0 +1,62 @@ +Fix build with glibc 2.26: + +https://github.com/tpaviot/oce/issues/675 + +Patch copied from upstream source repository: + +https://github.com/tpaviot/oce/commit/aa1321e68cc004e3debe38d79ae74581a617c767 + +From aa1321e68cc004e3debe38d79ae74581a617c767 Mon Sep 17 00:00:00 2001 +From: Janus Weil <janus@gcc.gnu.org> +Date: Mon, 18 Dec 2017 11:27:55 +0100 +Subject: [PATCH] fix build errors with glibc 2.26+ due to missing xlocale.h + (issue #675) + +* check for the presence of xlocale.h via cmake +* remove related logic from Standard_CLocaleSentry.hxx +--- + CMakeLists.txt | 1 + + src/Standard/Standard_CLocaleSentry.hxx | 15 --------------- + 2 files changed, 1 insertion(+), 15 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b782b4101..50e9500b2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -616,6 +616,7 @@ if (NOT WIN32) + # compilation anywhere in OCE + include(CheckIncludeFile) + check_include_file(strings.h HAVE_STRINGS_H) ++ check_include_file(xlocale.h HAVE_XLOCALE_H) + include(CheckIncludeFileCXX) + check_include_file_cxx(mm_malloc.h HAVE_MM_MALLOC_H) + check_include_file_cxx(atomic.h OCE_HAVE_ATOMIC_H) +diff --git a/src/Standard/Standard_CLocaleSentry.hxx b/src/Standard/Standard_CLocaleSentry.hxx +index 2b226e7f3..1a4c1dadc 100644 +--- a/src/Standard/Standard_CLocaleSentry.hxx ++++ b/src/Standard/Standard_CLocaleSentry.hxx +@@ -20,21 +20,6 @@ + + #include <locale.h> + +-#ifndef HAVE_XLOCALE_H +- //! "xlocale.h" available in Mac OS X and glibc (Linux) for a long time as an extension +- //! and become part of POSIX since '2008. +- //! Notice that this is impossible to test (_POSIX_C_SOURCE >= 200809L) +- //! since POSIX didn't declared such identifier. +- #if defined(__APPLE__) +- #define HAVE_XLOCALE_H +- #endif +- +- //! We check _GNU_SOURCE for glibc extensions here and it is always defined by g++ compiler. +- #if defined(_GNU_SOURCE) && !defined(__ANDROID__) +- #define HAVE_XLOCALE_H +- #endif +-#endif // ifndef HAVE_LOCALE_H +- + #ifdef HAVE_XLOCALE_H + #include <xlocale.h> + #endif +-- +2.15.1 + diff --git a/gnu/packages/patches/pcre-CVE-2017-7186.patch b/gnu/packages/patches/pcre-CVE-2017-7186.patch deleted file mode 100644 index d23aa10374..0000000000 --- a/gnu/packages/patches/pcre-CVE-2017-7186.patch +++ /dev/null @@ -1,56 +0,0 @@ -Patch for <https://nvd.nist.gov/vuln/detail?vulnId=CVE-2017-7186> -from <https://vcs.pcre.org/pcre?view=revision&revision=1688>. - ---- trunk/pcre_internal.h 2016/05/21 13:34:44 1649 -+++ trunk/pcre_internal.h 2017/02/24 17:30:30 1688 -@@ -2772,6 +2772,9 @@ - extern const pcre_uint16 PRIV(ucd_stage2)[]; - extern const pcre_uint32 PRIV(ucp_gentype)[]; - extern const pcre_uint32 PRIV(ucp_gbtable)[]; -+#ifdef COMPILE_PCRE32 -+extern const ucd_record PRIV(dummy_ucd_record)[]; -+#endif - #ifdef SUPPORT_JIT - extern const int PRIV(ucp_typerange)[]; - #endif -@@ -2780,9 +2783,15 @@ - /* UCD access macros */ - - #define UCD_BLOCK_SIZE 128 --#define GET_UCD(ch) (PRIV(ucd_records) + \ -+#define REAL_GET_UCD(ch) (PRIV(ucd_records) + \ - PRIV(ucd_stage2)[PRIV(ucd_stage1)[(int)(ch) / UCD_BLOCK_SIZE] * \ - UCD_BLOCK_SIZE + (int)(ch) % UCD_BLOCK_SIZE]) -+ -+#ifdef COMPILE_PCRE32 -+#define GET_UCD(ch) ((ch > 0x10ffff)? PRIV(dummy_ucd_record) : REAL_GET_UCD(ch)) -+#else -+#define GET_UCD(ch) REAL_GET_UCD(ch) -+#endif - - #define UCD_CHARTYPE(ch) GET_UCD(ch)->chartype - #define UCD_SCRIPT(ch) GET_UCD(ch)->script - ---- trunk/pcre_ucd.c 2014/06/19 07:51:39 1490 -+++ trunk/pcre_ucd.c 2017/02/24 17:30:30 1688 -@@ -38,6 +38,20 @@ - const pcre_uint32 PRIV(ucd_caseless_sets)[] = {0}; - #else - -+/* If the 32-bit library is run in non-32-bit mode, character values -+greater than 0x10ffff may be encountered. For these we set up a -+special record. */ -+ -+#ifdef COMPILE_PCRE32 -+const ucd_record PRIV(dummy_ucd_record)[] = {{ -+ ucp_Common, /* script */ -+ ucp_Cn, /* type unassigned */ -+ ucp_gbOther, /* grapheme break property */ -+ 0, /* case set */ -+ 0, /* other case */ -+ }}; -+#endif -+ - /* When recompiling tables with a new Unicode version, please check the - types in this structure definition from pcre_internal.h (the actual - field names will be different): diff --git a/gnu/packages/patches/potrace-tests.patch b/gnu/packages/patches/potrace-tests.patch new file mode 100644 index 0000000000..407be98dab --- /dev/null +++ b/gnu/packages/patches/potrace-tests.patch @@ -0,0 +1,50 @@ +This relaxes the comparison threshold between the reference data +and the bitmaps produced by Ghostscript interpreting the vectorized +image. Apparently the threshold has become too low with the switch +to from Ghostscript 2.21 to 2.22. + +--- potrace-1.15/check/postscript-check.sh 2018-01-06 19:47:26.194900686 +0100 ++++ potrace-1.15/check/postscript-check.sh 2018-01-06 19:51:35.937503739 +0100 +@@ -70,15 +70,15 @@ if test $? -ne 0; then + echo "Something is wrong with $GS; skipping this test" >& 2 + exit 77 + fi +-actiondiff "$TMP2" "$REFDATA" 1000 ++actiondiff "$TMP2" "$REFDATA" 1500 + + action $POTRACE -r50 -p -L 0 -B 0 --opaque -o "$TMP1" "$DATA" + action "$GS" -q -dNOPAUSE -sDEVICE=pbmraw -g460x394 -r100x100 -sOutputFile="$TMP2" -- "$TMP1" +-actiondiff "$TMP2" "$REFDATA" 1200 ++actiondiff "$TMP2" "$REFDATA" 1500 + + action $POTRACE -r50 -p -L 0 -B 0 -A 160 -o "$TMP1" "$DATA" + action "$GS" -q -dNOPAUSE -sDEVICE=pbmraw -g568x528 -r100x100 -sOutputFile="$TMP2" -- "$TMP1" +-actiondiff "$TMP2" "$REFDATAROT" 1200 ++actiondiff "$TMP2" "$REFDATAROT" 1500 + + action rm -f "$TMP1" + action rm -f "$TMP2" + +--- potrace-1.15/check/pdf-check.sh 2018-01-06 19:47:28.698886663 +0100 ++++ potrace-1.15/check/pdf-check.sh 2018-01-06 20:54:14.895460329 +0100 +@@ -72,15 +72,15 @@ if test $? -ne 0 -o ! -f "$TMP2"; then + echo "GS does not understand PDF; skipping this test" >& 2 + exit 77 + fi +-actiondiff "$TMP2" "$REFDATA" 1000 ++actiondiff "$TMP2" "$REFDATA" 1500 + + action $POTRACE -r50 -p -L 0 -B 0 --opaque -b pdf -o "$TMP1" "$DATA" + action "$GS" -q -dNOPAUSE -sDEVICE=pbmraw -g460x394 -r100x100 -sOutputFile="$TMP2" -- "$TMP1" +-actiondiff "$TMP2" "$REFDATA" 1200 ++actiondiff "$TMP2" "$REFDATA" 1500 + + action $POTRACE -r50 -p -L 0 -B 0 -A 160 -b pdf -o "$TMP1" "$DATA" + action "$GS" -q -dNOPAUSE -sDEVICE=pbmraw -g568x528 -r100x100 -sOutputFile="$TMP2" -- "$TMP1" +-actiondiff "$TMP2" "$REFDATAROT" 1200 ++actiondiff "$TMP2" "$REFDATAROT" 1500 + + action rm -f "$TMP1" + action rm -f "$TMP2" + +Diff finished. Sat Jan 6 20:54:50 2018 diff --git a/gnu/packages/patches/python-2.7-adjust-tests.patch b/gnu/packages/patches/python-2.7-adjust-tests.patch new file mode 100644 index 0000000000..12fe6e2e1e --- /dev/null +++ b/gnu/packages/patches/python-2.7-adjust-tests.patch @@ -0,0 +1,22 @@ +SIGINT is ignored in the Guix build environment. + +--- a/Lib/test/test_regrtest.py ++++ b/Lib/test/test_regrtest.py +@@ -399,6 +399,8 @@ + output = self.run_tests('--fromfile', filename) + self.check_executed_tests(output, tests) + ++ @unittest.skipIf(True, ++ "KeyboardInterrupts do not work in the build environment") + def test_interrupted(self): + code = TEST_INTERRUPTED + test = self.create_test('sigint', code=code) +@@ -416,6 +418,8 @@ + % (self.TESTNAME_REGEX, len(tests))) + self.check_line(output, regex) + ++ @unittest.skipIf(True, ++ "KeyboardInterrupts do not work in the build environment") + def test_slow_interrupted(self): + # Issue #25373: test --slowest with an interrupted test + code = TEST_INTERRUPTED diff --git a/gnu/packages/patches/python-2.7-getentropy-on-old-kernels.patch b/gnu/packages/patches/python-2.7-getentropy-on-old-kernels.patch deleted file mode 100644 index 5a09b4ac52..0000000000 --- a/gnu/packages/patches/python-2.7-getentropy-on-old-kernels.patch +++ /dev/null @@ -1,54 +0,0 @@ -This patch resolves a compatibility issue when compiled against glibc -2.25 -and run runder kernels < 3.17: - -https://bugzilla.redhat.com/show_bug.cgi?id=1410175 - -Upstream bug URLs: - -https://bugs.python.org/issue29157 -https://bugs.python.org/issue29188 - -Patch adapted from upstream source repository: - -https://github.com/python/cpython/commit/01bdbad3e951014c58581635b94b22868537901c - -From 01bdbad3e951014c58581635b94b22868537901c Mon Sep 17 00:00:00 2001 -From: Victor Stinner <victor.stinner@gmail.com> -Date: Mon, 9 Jan 2017 11:10:41 +0100 -Subject: [PATCH] Don't use getentropy() on Linux - -Issue #29188: Support glibc 2.24 on Linux: don't use getentropy() function but -read from /dev/urandom to get random bytes, for example in os.urandom(). On -Linux, getentropy() is implemented which getrandom() is blocking mode, whereas -os.urandom() should not block. ---- - Misc/NEWS | 5 +++++ - Python/random.c | 11 +++++++++-- - 2 files changed, 14 insertions(+), 2 deletions(-) - -diff --git a/Python/random.c b/Python/random.c -index 57c41ffcd6..000cb36938 100644 ---- a/Python/random.c -+++ b/Python/random.c -@@ -97,8 +97,15 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise) - } - - /* Issue #25003: Don't use getentropy() on Solaris (available since -- * Solaris 11.3), it is blocking whereas os.urandom() should not block. */ --#elif defined(HAVE_GETENTROPY) && !defined(sun) -+ Solaris 11.3), it is blocking whereas os.urandom() should not block. -+ -+ Issue #29188: Don't use getentropy() on Linux since the glibc 2.24 -+ implements it with the getrandom() syscall which can fail with ENOSYS, -+ and this error is not supported in py_getentropy() and getrandom() is called -+ with flags=0 which blocks until system urandom is initialized, which is not -+ the desired behaviour to seed the Python hash secret nor for os.urandom(): -+ see the PEP 524 which was only implemented in Python 3.6. */ -+#elif defined(HAVE_GETENTROPY) && !defined(sun) && !defined(linux) - #define PY_GETENTROPY 1 - - /* Fill buffer with size pseudo-random bytes generated by getentropy(). --- -2.12.0 - diff --git a/gnu/packages/patches/python-3-fix-tests.patch b/gnu/packages/patches/python-3-fix-tests.patch new file mode 100644 index 0000000000..ab713c54dd --- /dev/null +++ b/gnu/packages/patches/python-3-fix-tests.patch @@ -0,0 +1,149 @@ +Additional test fixes which affect Python 3.5 (and presumably later) but not +prior revisions of Python. + +--- Lib/test/test_pathlib.py 2014-03-01 03:02:36.088311000 +0100 ++++ Lib/test/test_pathlib.py 2014-03-01 04:56:37.768311000 +0100 +@@ -2132,8 +2132,7 @@ + self.assertEqual(given, expect) + self.assertEqual(set(p.rglob("FILEd*")), set()) + +- @unittest.skipUnless(hasattr(pwd, 'getpwall'), +- 'pwd module does not expose getpwall()') ++ @unittest.skipIf(True, "Guix builder home is '/' which causes trouble for these tests") + def test_expanduser(self): + P = self.cls + support.import_module('pwd') +--- Lib/test/test_tarfile.py 2016-02-24 19:22:52.597208055 +0000 ++++ Lib/test/test_tarfile.py 2016-02-24 20:50:48.941950135 +0000 +@@ -2305,11 +2305,14 @@ + try: + import pwd, grp + except ImportError: + return False +- if pwd.getpwuid(0)[0] != 'root': +- return False +- if grp.getgrgid(0)[0] != 'root': ++ try: ++ if pwd.getpwuid(0)[0] != 'root': ++ return False ++ if grp.getgrgid(0)[0] != 'root': ++ return False ++ except KeyError: + return False + return True + + +--- Lib/test/test_asyncio/test_base_events.py ++++ Lib/test/test_asyncio/test_base_events.py +@@ -1216,6 +1216,8 @@ + self._test_create_connection_ip_addr(m_socket, False) + + @patch_socket ++ @unittest.skipUnless(support.is_resource_enabled('network'), ++ 'network is not enabled') + def test_create_connection_service_name(self, m_socket): + m_socket.getaddrinfo = socket.getaddrinfo + sock = m_socket.socket.return_value + +--- Lib/test/test_pdb.py.org 2017-03-12 03:09:01.991856701 +0100 ++++ Lib/test/test_pdb.py 2017-03-12 03:26:17.742572869 +0100 + +For some reason, KeyboardInterrupts do not work in the build +environment (lack of controlling TTY?). Just change the expected +outcome. Unfortunately, this will make it fail for users running +`python -m test test_pdb test_pdb` interactively. + +@@ -928,11 +928,11 @@ + > <doctest test.test_pdb.test_pdb_issue_20766[0]>(6)test_function() + -> print('pdb %d: %s' % (i, sess._previous_sigint_handler)) + (Pdb) continue +- pdb 1: <built-in function default_int_handler> ++ pdb 1: Handlers.SIG_IGN + > <doctest test.test_pdb.test_pdb_issue_20766[0]>(5)test_function() + -> sess.set_trace(sys._getframe()) + (Pdb) continue +- pdb 2: <built-in function default_int_handler> ++ pdb 2: Handlers.SIG_IGN + """ + + class PdbTestCase(unittest.TestCase): +--- Lib/test/test_socket.py ++++ Lib/test/test_socket.py +@@ -802,6 +802,8 @@ + if not fqhn in all_host_names: + self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqhn, repr(all_host_names))) + ++ @unittest.skipUnless(support.is_resource_enabled('network'), ++ 'network is not enabled') + def test_host_resolution(self): + for addr in [support.HOST, '10.0.0.1', '255.255.255.255']: + self.assertEqual(socket.gethostbyname(addr), addr) +--- Lib/test/test_spwd.py ++++ Lib/test/test_spwd.py +@@ -5,8 +5,7 @@ + spwd = support.import_module('spwd') + + +-@unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() == 0, +- 'root privileges required') ++@unittest.skipUnless(os.path.exists("/etc/shadow"), 'spwd tests require /etc/shadow') + class TestSpwdRoot(unittest.TestCase): + + def test_getspall(self): +@@ -56,8 +55,7 @@ + self.assertRaises(TypeError, spwd.getspnam, bytes_name) + + +-@unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() != 0, +- 'non-root user required') ++@unittest.skipUnless(os.path.exists("/etc/shadow"), 'spwd tests require /etc/shadow') + class TestSpwdNonRoot(unittest.TestCase): + + def test_getspnam_exception(self): +--- Lib/test/test_regrtest.py ++++ Lib/test/test_regrtest.py +@@ -700,6 +700,7 @@ + output = self.run_tests('--fromfile', filename) + self.check_executed_tests(output, tests) + ++ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build environment.') + def test_interrupted(self): + code = TEST_INTERRUPTED + test = self.create_test('sigint', code=code) +@@ -717,6 +718,7 @@ + % (self.TESTNAME_REGEX, len(tests))) + self.check_line(output, regex) + ++ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build environment.') + def test_slow_interrupted(self): + # Issue #25373: test --slowest with an interrupted test + code = TEST_INTERRUPTED +--- Lib/test/test_generators.py ++++ Lib/test/test_generators.py +@@ -29,6 +29,7 @@ + else: + return "FAILED" + ++ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build environment') + def test_raise_and_yield_from(self): + gen = self.generator1() + gen.send(None) +--- Lib/test/test_normalization.py ++++ Lib/test/test_normalization.py +@@ -2,6 +2,7 @@ + import unittest + + from http.client import HTTPException ++from urllib.error import URLError + import sys + from unicodedata import normalize, unidata_version + +@@ -43,6 +44,8 @@ + except PermissionError: + self.skipTest(f"Permission error when downloading {TESTDATAURL} " + f"into the test data directory") ++ except URLError: ++ self.skipTest("DNS lookups are not enabled.") + except (OSError, HTTPException): + self.fail(f"Could not retrieve {TESTDATAURL}") + diff --git a/gnu/packages/patches/python-3.5-fix-tests.patch b/gnu/packages/patches/python-3.5-fix-tests.patch deleted file mode 100644 index 9778b88dbd..0000000000 --- a/gnu/packages/patches/python-3.5-fix-tests.patch +++ /dev/null @@ -1,69 +0,0 @@ -Additional test fixes which affect Python 3.5 (and presumably later) but not -prior revisions of Python. - ---- Lib/test/test_pathlib.py 2014-03-01 03:02:36.088311000 +0100 -+++ Lib/test/test_pathlib.py 2014-03-01 04:56:37.768311000 +0100 -@@ -1986,8 +1986,9 @@ - expect = set() if not support.fs_is_case_insensitive(BASE) else given - self.assertEqual(given, expect) - self.assertEqual(set(p.rglob("FILEd*")), set()) - -+ @unittest.skipIf(True, "Guix builder home is '/' which causes trouble for these tests") - def test_expanduser(self): - P = self.cls - support.import_module('pwd') - import pwd ---- Lib/test/test_tarfile.py 2016-02-24 19:22:52.597208055 +0000 -+++ Lib/test/test_tarfile.py 2016-02-24 20:50:48.941950135 +0000 -@@ -2305,11 +2305,14 @@ - try: - import pwd, grp - except ImportError: - return False -- if pwd.getpwuid(0)[0] != 'root': -- return False -- if grp.getgrgid(0)[0] != 'root': -+ try: -+ if pwd.getpwuid(0)[0] != 'root': -+ return False -+ if grp.getgrgid(0)[0] != 'root': -+ return False -+ except KeyError: - return False - return True - - ---- Lib/test/test_asyncio/test_base_events.py -+++ Lib/test/test_asyncio/test_base_events.py -@@ -1216,6 +1216,8 @@ - self._test_create_connection_ip_addr(m_socket, False) - - @patch_socket -+ @unittest.skipUnless(support.is_resource_enabled('network'), -+ 'network is not enabled') - def test_create_connection_service_name(self, m_socket): - m_socket.getaddrinfo = socket.getaddrinfo - sock = m_socket.socket.return_value - ---- Lib/test/test_pdb.py.org 2017-03-12 03:09:01.991856701 +0100 -+++ Lib/test/test_pdb.py 2017-03-12 03:26:17.742572869 +0100 - -For some reason, KeyboardInterrupts do not work in the build -environment (lack of controlling TTY?). Just change the expected -outcome. Unfortunately, this will make it fail for users running -`python -m test test_pdb test_pdb` interactively. - -@@ -928,11 +928,11 @@ - > <doctest test.test_pdb.test_pdb_issue_20766[0]>(6)test_function() - -> print('pdb %d: %s' % (i, sess._previous_sigint_handler)) - (Pdb) continue -- pdb 1: <built-in function default_int_handler> -+ pdb 1: Handlers.SIG_IGN - > <doctest test.test_pdb.test_pdb_issue_20766[0]>(5)test_function() - -> sess.set_trace(sys._getframe()) - (Pdb) continue -- pdb 2: <built-in function default_int_handler> -+ pdb 2: Handlers.SIG_IGN - """ - - class PdbTestCase(unittest.TestCase): diff --git a/gnu/packages/patches/python-3.5-getentropy-on-old-kernels.patch b/gnu/packages/patches/python-3.5-getentropy-on-old-kernels.patch deleted file mode 100644 index 8a12b5b448..0000000000 --- a/gnu/packages/patches/python-3.5-getentropy-on-old-kernels.patch +++ /dev/null @@ -1,720 +0,0 @@ -This patch resolves a compatibility issue when compiled against glibc 2.25 -and run runder kernels < 3.17: - -https://bugzilla.redhat.com/show_bug.cgi?id=1410175 - -Upstream bug URL: https://bugs.python.org/issue29157 - -Patch copied from upstream source repository: - -https://hg.python.org/cpython/rev/8125d9a8152b - -# HG changeset patch -# User Victor Stinner <victor.stinner@gmail.com> -# Date 1483957133 -3600 -# Node ID 8125d9a8152b79e712cb09c7094b9129b9bcea86 -# Parent 337461574c90281630751b6095c4e1baf380cf7d -Issue #29157: Prefer getrandom() over getentropy() - -Copy and then adapt Python/random.c from default branch. Difference between 3.5 -and default branches: - -* Python 3.5 only uses getrandom() in non-blocking mode: flags=GRND_NONBLOCK -* If getrandom() fails with EAGAIN: py_getrandom() immediately fails and - remembers that getrandom() doesn't work. -* Python 3.5 has no _PyOS_URandomNonblock() function: _PyOS_URandom() - works in non-blocking mode on Python 3.5 - -diff --git a/Python/random.c b/Python/random.c ---- Python/random.c -+++ Python/random.c -@@ -1,6 +1,9 @@ - #include "Python.h" - #ifdef MS_WINDOWS - # include <windows.h> -+/* All sample MSDN wincrypt programs include the header below. It is at least -+ * required with Min GW. */ -+# include <wincrypt.h> - #else - # include <fcntl.h> - # ifdef HAVE_SYS_STAT_H -@@ -37,10 +40,9 @@ win32_urandom_init(int raise) - return 0; - - error: -- if (raise) -+ if (raise) { - PyErr_SetFromWindowsErr(0); -- else -- Py_FatalError("Failed to initialize Windows random API (CryptoGen)"); -+ } - return -1; - } - -@@ -53,8 +55,9 @@ win32_urandom(unsigned char *buffer, Py_ - - if (hCryptProv == 0) - { -- if (win32_urandom_init(raise) == -1) -+ if (win32_urandom_init(raise) == -1) { - return -1; -+ } - } - - while (size > 0) -@@ -63,11 +66,9 @@ win32_urandom(unsigned char *buffer, Py_ - if (!CryptGenRandom(hCryptProv, (DWORD)chunk, buffer)) - { - /* CryptGenRandom() failed */ -- if (raise) -+ if (raise) { - PyErr_SetFromWindowsErr(0); -- else -- Py_FatalError("Failed to initialized the randomized hash " -- "secret using CryptoGen)"); -+ } - return -1; - } - buffer += chunk; -@@ -76,58 +77,23 @@ win32_urandom(unsigned char *buffer, Py_ - return 0; - } - --/* Issue #25003: Don't use getentropy() on Solaris (available since -- * Solaris 11.3), it is blocking whereas os.urandom() should not block. */ --#elif defined(HAVE_GETENTROPY) && !defined(sun) --#define PY_GETENTROPY 1 -- --/* Fill buffer with size pseudo-random bytes generated by getentropy(). -- Return 0 on success, or raise an exception and return -1 on error. -- -- If fatal is nonzero, call Py_FatalError() instead of raising an exception -- on error. */ --static int --py_getentropy(unsigned char *buffer, Py_ssize_t size, int fatal) --{ -- while (size > 0) { -- Py_ssize_t len = Py_MIN(size, 256); -- int res; -- -- if (!fatal) { -- Py_BEGIN_ALLOW_THREADS -- res = getentropy(buffer, len); -- Py_END_ALLOW_THREADS -- -- if (res < 0) { -- PyErr_SetFromErrno(PyExc_OSError); -- return -1; -- } -- } -- else { -- res = getentropy(buffer, len); -- if (res < 0) -- Py_FatalError("getentropy() failed"); -- } -- -- buffer += len; -- size -= len; -- } -- return 0; --} -- --#else -+#else /* !MS_WINDOWS */ - - #if defined(HAVE_GETRANDOM) || defined(HAVE_GETRANDOM_SYSCALL) - #define PY_GETRANDOM 1 - --/* Call getrandom() -+/* Call getrandom() to get random bytes: -+ - - Return 1 on success -- - Return 0 if getrandom() syscall is not available (failed with ENOSYS or -- EPERM) or if getrandom(GRND_NONBLOCK) failed with EAGAIN (system urandom -- not initialized yet) and raise=0. -+ - Return 0 if getrandom() is not available (failed with ENOSYS or EPERM), -+ or if getrandom(GRND_NONBLOCK) failed with EAGAIN (system urandom not -+ initialized yet). - - Raise an exception (if raise is non-zero) and return -1 on error: -- getrandom() failed with EINTR and the Python signal handler raised an -- exception, or getrandom() failed with a different error. */ -+ if getrandom() failed with EINTR, raise is non-zero and the Python signal -+ handler raised an exception, or if getrandom() failed with a different -+ error. -+ -+ getrandom() is retried if it failed with EINTR: interrupted by a signal. */ - static int - py_getrandom(void *buffer, Py_ssize_t size, int raise) - { -@@ -142,16 +108,19 @@ py_getrandom(void *buffer, Py_ssize_t si - * see https://bugs.python.org/issue26839. To avoid this, use the - * GRND_NONBLOCK flag. */ - const int flags = GRND_NONBLOCK; -+ char *dest; - long n; - - if (!getrandom_works) { - return 0; - } - -+ dest = buffer; - while (0 < size) { - #ifdef sun - /* Issue #26735: On Solaris, getrandom() is limited to returning up -- to 1024 bytes */ -+ to 1024 bytes. Call it multiple times if more bytes are -+ requested. */ - n = Py_MIN(size, 1024); - #else - n = Py_MIN(size, LONG_MAX); -@@ -161,34 +130,35 @@ py_getrandom(void *buffer, Py_ssize_t si - #ifdef HAVE_GETRANDOM - if (raise) { - Py_BEGIN_ALLOW_THREADS -- n = getrandom(buffer, n, flags); -+ n = getrandom(dest, n, flags); - Py_END_ALLOW_THREADS - } - else { -- n = getrandom(buffer, n, flags); -+ n = getrandom(dest, n, flags); - } - #else - /* On Linux, use the syscall() function because the GNU libc doesn't -- * expose the Linux getrandom() syscall yet. See: -- * https://sourceware.org/bugzilla/show_bug.cgi?id=17252 */ -+ expose the Linux getrandom() syscall yet. See: -+ https://sourceware.org/bugzilla/show_bug.cgi?id=17252 */ - if (raise) { - Py_BEGIN_ALLOW_THREADS -- n = syscall(SYS_getrandom, buffer, n, flags); -+ n = syscall(SYS_getrandom, dest, n, flags); - Py_END_ALLOW_THREADS - } - else { -- n = syscall(SYS_getrandom, buffer, n, flags); -+ n = syscall(SYS_getrandom, dest, n, flags); - } - #endif - - if (n < 0) { -- /* ENOSYS: getrandom() syscall not supported by the kernel (but -- * maybe supported by the host which built Python). EPERM: -- * getrandom() syscall blocked by SECCOMP or something else. */ -+ /* ENOSYS: the syscall is not supported by the kernel. -+ EPERM: the syscall is blocked by a security policy (ex: SECCOMP) -+ or something else. */ - if (errno == ENOSYS || errno == EPERM) { - getrandom_works = 0; - return 0; - } -+ - if (errno == EAGAIN) { - /* getrandom(GRND_NONBLOCK) fails with EAGAIN if the system - urandom is not initialiazed yet. In this case, fall back on -@@ -202,32 +172,101 @@ py_getrandom(void *buffer, Py_ssize_t si - } - - if (errno == EINTR) { -- if (PyErr_CheckSignals()) { -- if (!raise) { -- Py_FatalError("getrandom() interrupted by a signal"); -+ if (raise) { -+ if (PyErr_CheckSignals()) { -+ return -1; - } -- return -1; - } - -- /* retry getrandom() */ -+ /* retry getrandom() if it was interrupted by a signal */ - continue; - } - - if (raise) { - PyErr_SetFromErrno(PyExc_OSError); - } -- else { -- Py_FatalError("getrandom() failed"); -+ return -1; -+ } -+ -+ dest += n; -+ size -= n; -+ } -+ return 1; -+} -+ -+#elif defined(HAVE_GETENTROPY) -+#define PY_GETENTROPY 1 -+ -+/* Fill buffer with size pseudo-random bytes generated by getentropy(): -+ -+ - Return 1 on success -+ - Return 0 if getentropy() syscall is not available (failed with ENOSYS or -+ EPERM). -+ - Raise an exception (if raise is non-zero) and return -1 on error: -+ if getentropy() failed with EINTR, raise is non-zero and the Python signal -+ handler raised an exception, or if getentropy() failed with a different -+ error. -+ -+ getentropy() is retried if it failed with EINTR: interrupted by a signal. */ -+static int -+py_getentropy(char *buffer, Py_ssize_t size, int raise) -+{ -+ /* Is getentropy() supported by the running kernel? Set to 0 if -+ getentropy() failed with ENOSYS or EPERM. */ -+ static int getentropy_works = 1; -+ -+ if (!getentropy_works) { -+ return 0; -+ } -+ -+ while (size > 0) { -+ /* getentropy() is limited to returning up to 256 bytes. Call it -+ multiple times if more bytes are requested. */ -+ Py_ssize_t len = Py_MIN(size, 256); -+ int res; -+ -+ if (raise) { -+ Py_BEGIN_ALLOW_THREADS -+ res = getentropy(buffer, len); -+ Py_END_ALLOW_THREADS -+ } -+ else { -+ res = getentropy(buffer, len); -+ } -+ -+ if (res < 0) { -+ /* ENOSYS: the syscall is not supported by the running kernel. -+ EPERM: the syscall is blocked by a security policy (ex: SECCOMP) -+ or something else. */ -+ if (errno == ENOSYS || errno == EPERM) { -+ getentropy_works = 0; -+ return 0; -+ } -+ -+ if (errno == EINTR) { -+ if (raise) { -+ if (PyErr_CheckSignals()) { -+ return -1; -+ } -+ } -+ -+ /* retry getentropy() if it was interrupted by a signal */ -+ continue; -+ } -+ -+ if (raise) { -+ PyErr_SetFromErrno(PyExc_OSError); - } - return -1; - } - -- buffer += n; -- size -= n; -+ buffer += len; -+ size -= len; - } - return 1; - } --#endif -+#endif /* defined(HAVE_GETENTROPY) && !defined(sun) */ -+ - - static struct { - int fd; -@@ -235,136 +274,123 @@ static struct { - ino_t st_ino; - } urandom_cache = { -1 }; - -+/* Read random bytes from the /dev/urandom device: - --/* Read 'size' random bytes from py_getrandom(). Fall back on reading from -- /dev/urandom if getrandom() is not available. -+ - Return 0 on success -+ - Raise an exception (if raise is non-zero) and return -1 on error - -- Call Py_FatalError() on error. */ --static void --dev_urandom_noraise(unsigned char *buffer, Py_ssize_t size) -+ Possible causes of errors: -+ -+ - open() failed with ENOENT, ENXIO, ENODEV, EACCES: the /dev/urandom device -+ was not found. For example, it was removed manually or not exposed in a -+ chroot or container. -+ - open() failed with a different error -+ - fstat() failed -+ - read() failed or returned 0 -+ -+ read() is retried if it failed with EINTR: interrupted by a signal. -+ -+ The file descriptor of the device is kept open between calls to avoid using -+ many file descriptors when run in parallel from multiple threads: -+ see the issue #18756. -+ -+ st_dev and st_ino fields of the file descriptor (from fstat()) are cached to -+ check if the file descriptor was replaced by a different file (which is -+ likely a bug in the application): see the issue #21207. -+ -+ If the file descriptor was closed or replaced, open a new file descriptor -+ but don't close the old file descriptor: it probably points to something -+ important for some third-party code. */ -+static int -+dev_urandom(char *buffer, Py_ssize_t size, int raise) - { - int fd; - Py_ssize_t n; - -- assert (0 < size); -+ if (raise) { -+ struct _Py_stat_struct st; - --#ifdef PY_GETRANDOM -- if (py_getrandom(buffer, size, 0) == 1) { -- return; -+ if (urandom_cache.fd >= 0) { -+ /* Does the fd point to the same thing as before? (issue #21207) */ -+ if (_Py_fstat_noraise(urandom_cache.fd, &st) -+ || st.st_dev != urandom_cache.st_dev -+ || st.st_ino != urandom_cache.st_ino) { -+ /* Something changed: forget the cached fd (but don't close it, -+ since it probably points to something important for some -+ third-party code). */ -+ urandom_cache.fd = -1; -+ } -+ } -+ if (urandom_cache.fd >= 0) -+ fd = urandom_cache.fd; -+ else { -+ fd = _Py_open("/dev/urandom", O_RDONLY); -+ if (fd < 0) { -+ if (errno == ENOENT || errno == ENXIO || -+ errno == ENODEV || errno == EACCES) { -+ PyErr_SetString(PyExc_NotImplementedError, -+ "/dev/urandom (or equivalent) not found"); -+ } -+ /* otherwise, keep the OSError exception raised by _Py_open() */ -+ return -1; -+ } -+ if (urandom_cache.fd >= 0) { -+ /* urandom_fd was initialized by another thread while we were -+ not holding the GIL, keep it. */ -+ close(fd); -+ fd = urandom_cache.fd; -+ } -+ else { -+ if (_Py_fstat(fd, &st)) { -+ close(fd); -+ return -1; -+ } -+ else { -+ urandom_cache.fd = fd; -+ urandom_cache.st_dev = st.st_dev; -+ urandom_cache.st_ino = st.st_ino; -+ } -+ } -+ } -+ -+ do { -+ n = _Py_read(fd, buffer, (size_t)size); -+ if (n == -1) -+ return -1; -+ if (n == 0) { -+ PyErr_Format(PyExc_RuntimeError, -+ "Failed to read %zi bytes from /dev/urandom", -+ size); -+ return -1; -+ } -+ -+ buffer += n; -+ size -= n; -+ } while (0 < size); - } -- /* getrandom() failed with ENOSYS or EPERM, -- fall back on reading /dev/urandom */ --#endif -- -- fd = _Py_open_noraise("/dev/urandom", O_RDONLY); -- if (fd < 0) { -- Py_FatalError("Failed to open /dev/urandom"); -- } -- -- while (0 < size) -- { -- do { -- n = read(fd, buffer, (size_t)size); -- } while (n < 0 && errno == EINTR); -- -- if (n <= 0) { -- /* read() failed or returned 0 bytes */ -- Py_FatalError("Failed to read bytes from /dev/urandom"); -- break; -- } -- buffer += n; -- size -= n; -- } -- close(fd); --} -- --/* Read 'size' random bytes from py_getrandom(). Fall back on reading from -- /dev/urandom if getrandom() is not available. -- -- Return 0 on success. Raise an exception and return -1 on error. */ --static int --dev_urandom_python(char *buffer, Py_ssize_t size) --{ -- int fd; -- Py_ssize_t n; -- struct _Py_stat_struct st; --#ifdef PY_GETRANDOM -- int res; --#endif -- -- if (size <= 0) -- return 0; -- --#ifdef PY_GETRANDOM -- res = py_getrandom(buffer, size, 1); -- if (res < 0) { -- return -1; -- } -- if (res == 1) { -- return 0; -- } -- /* getrandom() failed with ENOSYS or EPERM, -- fall back on reading /dev/urandom */ --#endif -- -- if (urandom_cache.fd >= 0) { -- /* Does the fd point to the same thing as before? (issue #21207) */ -- if (_Py_fstat_noraise(urandom_cache.fd, &st) -- || st.st_dev != urandom_cache.st_dev -- || st.st_ino != urandom_cache.st_ino) { -- /* Something changed: forget the cached fd (but don't close it, -- since it probably points to something important for some -- third-party code). */ -- urandom_cache.fd = -1; -- } -- } -- if (urandom_cache.fd >= 0) -- fd = urandom_cache.fd; - else { -- fd = _Py_open("/dev/urandom", O_RDONLY); -+ fd = _Py_open_noraise("/dev/urandom", O_RDONLY); - if (fd < 0) { -- if (errno == ENOENT || errno == ENXIO || -- errno == ENODEV || errno == EACCES) -- PyErr_SetString(PyExc_NotImplementedError, -- "/dev/urandom (or equivalent) not found"); -- /* otherwise, keep the OSError exception raised by _Py_open() */ - return -1; - } -- if (urandom_cache.fd >= 0) { -- /* urandom_fd was initialized by another thread while we were -- not holding the GIL, keep it. */ -- close(fd); -- fd = urandom_cache.fd; -- } -- else { -- if (_Py_fstat(fd, &st)) { -+ -+ while (0 < size) -+ { -+ do { -+ n = read(fd, buffer, (size_t)size); -+ } while (n < 0 && errno == EINTR); -+ -+ if (n <= 0) { -+ /* stop on error or if read(size) returned 0 */ - close(fd); - return -1; - } -- else { -- urandom_cache.fd = fd; -- urandom_cache.st_dev = st.st_dev; -- urandom_cache.st_ino = st.st_ino; -- } -+ -+ buffer += n; -+ size -= n; - } -+ close(fd); - } -- -- do { -- n = _Py_read(fd, buffer, (size_t)size); -- if (n == -1) { -- return -1; -- } -- if (n == 0) { -- PyErr_Format(PyExc_RuntimeError, -- "Failed to read %zi bytes from /dev/urandom", -- size); -- return -1; -- } -- -- buffer += n; -- size -= n; -- } while (0 < size); -- - return 0; - } - -@@ -376,8 +402,8 @@ dev_urandom_close(void) - urandom_cache.fd = -1; - } - } -+#endif /* !MS_WINDOWS */ - --#endif - - /* Fill buffer with pseudo-random bytes generated by a linear congruent - generator (LCG): -@@ -400,29 +426,98 @@ lcg_urandom(unsigned int x0, unsigned ch - } - } - -+/* Read random bytes: -+ -+ - Return 0 on success -+ - Raise an exception (if raise is non-zero) and return -1 on error -+ -+ Used sources of entropy ordered by preference, preferred source first: -+ -+ - CryptGenRandom() on Windows -+ - getrandom() function (ex: Linux and Solaris): call py_getrandom() -+ - getentropy() function (ex: OpenBSD): call py_getentropy() -+ - /dev/urandom device -+ -+ Read from the /dev/urandom device if getrandom() or getentropy() function -+ is not available or does not work. -+ -+ Prefer getrandom() over getentropy() because getrandom() supports blocking -+ and non-blocking mode and Python requires non-blocking RNG at startup to -+ initialize its hash secret: see the PEP 524. -+ -+ Prefer getrandom() and getentropy() over reading directly /dev/urandom -+ because these functions don't need file descriptors and so avoid ENFILE or -+ EMFILE errors (too many open files): see the issue #18756. -+ -+ Only use RNG running in the kernel. They are more secure because it is -+ harder to get the internal state of a RNG running in the kernel land than a -+ RNG running in the user land. The kernel has a direct access to the hardware -+ and has access to hardware RNG, they are used as entropy sources. -+ -+ Note: the OpenSSL RAND_pseudo_bytes() function does not automatically reseed -+ its RNG on fork(), two child processes (with the same pid) generate the same -+ random numbers: see issue #18747. Kernel RNGs don't have this issue, -+ they have access to good quality entropy sources. -+ -+ If raise is zero: -+ -+ - Don't raise an exception on error -+ - Don't call the Python signal handler (don't call PyErr_CheckSignals()) if -+ a function fails with EINTR: retry directly the interrupted function -+ - Don't release the GIL to call functions. -+*/ -+static int -+pyurandom(void *buffer, Py_ssize_t size, int raise) -+{ -+#if defined(PY_GETRANDOM) || defined(PY_GETENTROPY) -+ int res; -+#endif -+ -+ if (size < 0) { -+ if (raise) { -+ PyErr_Format(PyExc_ValueError, -+ "negative argument not allowed"); -+ } -+ return -1; -+ } -+ -+ if (size == 0) { -+ return 0; -+ } -+ -+#ifdef MS_WINDOWS -+ return win32_urandom((unsigned char *)buffer, size, raise); -+#else -+ -+#if defined(PY_GETRANDOM) || defined(PY_GETENTROPY) -+#ifdef PY_GETRANDOM -+ res = py_getrandom(buffer, size, raise); -+#else -+ res = py_getentropy(buffer, size, raise); -+#endif -+ if (res < 0) { -+ return -1; -+ } -+ if (res == 1) { -+ return 0; -+ } -+ /* getrandom() or getentropy() function is not available: failed with -+ ENOSYS, EPERM or EAGAIN. Fall back on reading from /dev/urandom. */ -+#endif -+ -+ return dev_urandom(buffer, size, raise); -+#endif -+} -+ - /* Fill buffer with size pseudo-random bytes from the operating system random - number generator (RNG). It is suitable for most cryptographic purposes - except long living private keys for asymmetric encryption. - -- Return 0 on success, raise an exception and return -1 on error. */ -+ Return 0 on success. Raise an exception and return -1 on error. */ - int - _PyOS_URandom(void *buffer, Py_ssize_t size) - { -- if (size < 0) { -- PyErr_Format(PyExc_ValueError, -- "negative argument not allowed"); -- return -1; -- } -- if (size == 0) -- return 0; -- --#ifdef MS_WINDOWS -- return win32_urandom((unsigned char *)buffer, size, 1); --#elif defined(PY_GETENTROPY) -- return py_getentropy(buffer, size, 0); --#else -- return dev_urandom_python((char*)buffer, size); --#endif -+ return pyurandom(buffer, size, 1); - } - - void -@@ -463,13 +558,14 @@ void - } - } - else { --#ifdef MS_WINDOWS -- (void)win32_urandom(secret, secret_size, 0); --#elif defined(PY_GETENTROPY) -- (void)py_getentropy(secret, secret_size, 1); --#else -- dev_urandom_noraise(secret, secret_size); --#endif -+ int res; -+ -+ /* _PyRandom_Init() is called very early in the Python initialization -+ and so exceptions cannot be used (use raise=0). */ -+ res = pyurandom(secret, secret_size, 0); -+ if (res < 0) { -+ Py_FatalError("failed to get random numbers to initialize Python"); -+ } - } - } - -@@ -481,8 +577,6 @@ void - CryptReleaseContext(hCryptProv, 0); - hCryptProv = 0; - } --#elif defined(PY_GETENTROPY) -- /* nothing to clean */ - #else - dev_urandom_close(); - #endif - diff --git a/gnu/packages/patches/python-unittest2-python3-compat.patch b/gnu/packages/patches/python-unittest2-python3-compat.patch new file mode 100644 index 0000000000..fe0afe559a --- /dev/null +++ b/gnu/packages/patches/python-unittest2-python3-compat.patch @@ -0,0 +1,34 @@ +Skip tests that fail with newer versions of Python. + +Patch copied from Gentoo: + +https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-python/unittest2/files/unittest2-1.1.0-python3.5-test.patch + +diff --git a/unittest2/test/test_loader.py b/unittest2/test/test_loader.py +index 683f662..347eea5 100644 +--- a/unittest2/test/test_loader.py ++++ b/unittest2/test/test_loader.py +@@ -509,6 +509,7 @@ class Test_TestLoader(unittest2.TestCase): + # + # What happens when an impossible name is given, relative to the provided + # `module`? ++ @unittest.skipIf(sys.version_info[:2] >= (3, 5), "python 3.5 has problems here") + def test_loadTestsFromName__relative_malformed_name(self): + loader = unittest.TestLoader() + +@@ -811,6 +812,7 @@ class Test_TestLoader(unittest2.TestCase): + # TestCase or TestSuite instance." + # + # What happens when presented with an impossible module name? ++ @unittest.skipIf(sys.version_info[:2] >= (3, 5), "python 3.5 has problems here") + def test_loadTestsFromNames__malformed_name(self): + loader = unittest2.TestLoader() + +@@ -918,6 +920,7 @@ class Test_TestLoader(unittest2.TestCase): + # "The method optionally resolves name relative to the given module" + # + # What happens when presented with an impossible attribute name? ++ @unittest.skipIf(sys.version_info[:2] >= (3, 5), "python 3.5 has problems here") + def test_loadTestsFromNames__relative_malformed_name(self): + loader = unittest.TestLoader() + diff --git a/gnu/packages/patches/python2-unittest2-remove-argparse.patch b/gnu/packages/patches/python-unittest2-remove-argparse.patch index c96738757e..c96738757e 100644 --- a/gnu/packages/patches/python2-unittest2-remove-argparse.patch +++ b/gnu/packages/patches/python-unittest2-remove-argparse.patch diff --git a/gnu/packages/patches/tcl-mkindex-deterministic.patch b/gnu/packages/patches/tcl-mkindex-deterministic.patch deleted file mode 100644 index 2fcef6a4f7..0000000000 --- a/gnu/packages/patches/tcl-mkindex-deterministic.patch +++ /dev/null @@ -1,29 +0,0 @@ -This patch ensures that the 'tclIndex' files generated by 'auto_mkindex' -are sorted in a deterministic fashion. - -Fixes a non-determinism issue reported -at <https://lists.gnu.org/archive/html/guix-devel/2015-10/msg00696.html>. - ---- tcl8.6.4/library/auto.tcl 2015-02-26 17:57:28.000000000 +0100 -+++ tcl8.6.4/library/auto.tcl 2015-11-13 23:18:34.964831717 +0100 -@@ -207,6 +207,9 @@ proc auto_mkindex {dir args} { - set args *.tcl - } - -+ # Keep file names sorted in a determistic order. -+ set args [lsort -ascii $args] -+ - auto_mkindex_parser::init - foreach file [glob -- {*}$args] { - try { -@@ -241,6 +244,10 @@ proc auto_mkindex_old {dir args} { - if {![llength $args]} { - set args *.tcl - } -+ -+ # Keep file names sorted in a determistic order. -+ set args [lsort -ascii $args] -+ - foreach file [glob -- {*}$args] { - set f "" - set error [catch { diff --git a/gnu/packages/patches/valgrind-glibc-compat.patch b/gnu/packages/patches/valgrind-glibc-compat.patch new file mode 100644 index 0000000000..4f8effd207 --- /dev/null +++ b/gnu/packages/patches/valgrind-glibc-compat.patch @@ -0,0 +1,18 @@ +Fix build failure with glibc 2.26. + +Patch copied from upstream source repository: +https://sourceware.org/git/?p=valgrind.git;a=commit;h=2b5eab6a8db1b0487a3ad7fc4e7eeda6d3513626 + +diff --git a/memcheck/tests/linux/stack_changes.c b/memcheck/tests/linux/stack_changes.c +index a978fc2..7f97b90 100644 +--- a/memcheck/tests/linux/stack_changes.c ++++ b/memcheck/tests/linux/stack_changes.c +@@ -10,7 +10,7 @@ + // This test is checking the libc context calls (setcontext, etc.) and + // checks that Valgrind notices their stack changes properly. + +-typedef struct ucontext mycontext; ++typedef ucontext_t mycontext; + + mycontext ctx1, ctx2, oldc; + int count; |