[Pkg-gnupg-commit] [libgpg-error] 02/04: more bugfixes and cleanup from upstream
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Mon Jun 26 16:05:21 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch master
in repository libgpg-error.
commit b1d7c54f615caa7dc301240512202966fdd1e204
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date: Mon Jun 26 11:55:02 2017 -0400
more bugfixes and cleanup from upstream
---
...3-w32-Conditionalize-ISO-2022-definitions.patch | 35 +++++++++++
debian/patches/0004-Minor-clean-up.patch | 72 ++++++++++++++++++++++
.../patches/0005-Fix-memory-leak-for-estream.patch | 62 +++++++++++++++++++
.../0006-build-Prepend-the-maintainer-CFLAGS.patch | 51 +++++++++++++++
...Align-es_poll-semantics-closer-with-POSIX.patch | 33 ++++++++++
debian/patches/series | 5 ++
6 files changed, 258 insertions(+)
diff --git a/debian/patches/0003-w32-Conditionalize-ISO-2022-definitions.patch b/debian/patches/0003-w32-Conditionalize-ISO-2022-definitions.patch
new file mode 100644
index 0000000..8e6d29b
--- /dev/null
+++ b/debian/patches/0003-w32-Conditionalize-ISO-2022-definitions.patch
@@ -0,0 +1,35 @@
+From: NIIBE Yutaka <gniibe at fsij.org>
+Date: Tue, 7 Mar 2017 09:57:16 +0900
+Subject: w32: Conditionalize ISO 2022 definitions.
+
+* src/w32-iconv.c (iso2022_SI_seq, iso2022_SO_seq) [USE_MLANG_DLL]:
+Only for USE_MLANG_DLL.
+
+--
+
+Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
+(cherry picked from commit 1126c4c117a47c8ea8435ac11561d51b13f538dd)
+---
+ src/w32-iconv.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/w32-iconv.c b/src/w32-iconv.c
+index c10bb32..888b722 100644
+--- a/src/w32-iconv.c
++++ b/src/w32-iconv.c
+@@ -1475,6 +1475,7 @@ utf32_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
+ #define ISO2022_SI 0
+ #define ISO2022_SO 1
+
++#if USE_MLANG_DLL
+ /* shift in */
+ static const char iso2022_SI_seq[] = "\x0F";
+ /* shift out */
+@@ -1487,6 +1488,7 @@ struct iso2022_esc_t {
+ int len;
+ int cs;
+ };
++#endif
+
+ #define ISO2022JP_CS_ASCII 0
+ #define ISO2022JP_CS_JISX0201_ROMAN 1
diff --git a/debian/patches/0004-Minor-clean-up.patch b/debian/patches/0004-Minor-clean-up.patch
new file mode 100644
index 0000000..e075468
--- /dev/null
+++ b/debian/patches/0004-Minor-clean-up.patch
@@ -0,0 +1,72 @@
+From: NIIBE Yutaka <gniibe at fsij.org>
+Date: Wed, 19 Apr 2017 13:32:36 +0900
+Subject: Minor clean up.
+
+* src/b64dec.c (_gpgrt_b64dec_proc): Add a comment.
+* src/estream.c (_gpgrt_fread, _gpgrt_fwrite): Use &&.
+* src/mkheader.c (xstrdup): Use memcpy as we know length.
+
+Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
+(cherry picked from commit a8d267a7220399f7acf69723fe1d31efd2160319)
+---
+ src/b64dec.c | 1 +
+ src/estream.c | 4 ++--
+ src/mkheader.c | 5 +++--
+ 3 files changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/src/b64dec.c b/src/b64dec.c
+index d846a6a..a8a8351 100644
+--- a/src/b64dec.c
++++ b/src/b64dec.c
+@@ -140,6 +140,7 @@ _gpgrt_b64dec_proc (gpgrt_b64state_t state, void *buffer, size_t length,
+ break;
+ case s_init:
+ ds = s_lfseen;
++ /* Fall through */
+ case s_lfseen:
+ if (*s != "-----BEGIN "[pos])
+ {
+diff --git a/src/estream.c b/src/estream.c
+index 9f227a6..066fe02 100644
+--- a/src/estream.c
++++ b/src/estream.c
+@@ -4179,7 +4179,7 @@ _gpgrt_fread (void *_GPGRT__RESTRICT ptr, size_t size, size_t nitems,
+ {
+ size_t ret, bytes;
+
+- if (size * nitems)
++ if (size && nitems)
+ {
+ lock_stream (stream);
+ es_readn (stream, ptr, size * nitems, &bytes);
+@@ -4200,7 +4200,7 @@ _gpgrt_fwrite (const void *_GPGRT__RESTRICT ptr, size_t size, size_t nitems,
+ {
+ size_t ret, bytes;
+
+- if (size * nitems)
++ if (size && nitems)
+ {
+ lock_stream (stream);
+ es_writen (stream, ptr, size * nitems, &bytes);
+diff --git a/src/mkheader.c b/src/mkheader.c
+index 5aeb1e7..997cab5 100644
+--- a/src/mkheader.c
++++ b/src/mkheader.c
+@@ -52,14 +52,15 @@ static char *
+ xstrdup (const char *string)
+ {
+ char *p;
++ size_t len = strlen (string) + 1;
+
+- p = malloc (strlen (string)+1);
++ p = malloc (len);
+ if (!p)
+ {
+ fputs (PGM ": out of core\n", stderr);
+ exit (1);
+ }
+- strcpy (p, string);
++ memcpy (p, string, len);
+ return p;
+ }
+
diff --git a/debian/patches/0005-Fix-memory-leak-for-estream.patch b/debian/patches/0005-Fix-memory-leak-for-estream.patch
new file mode 100644
index 0000000..2570074
--- /dev/null
+++ b/debian/patches/0005-Fix-memory-leak-for-estream.patch
@@ -0,0 +1,62 @@
+From: NIIBE Yutaka <gniibe at fsij.org>
+Date: Tue, 30 May 2017 20:46:12 +0900
+Subject: Fix memory leak for estream.
+
+* src/estream.c (do_list_remove): Free the item.
+(do_close): Free the buffer.
+
+Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
+(cherry picked from commit 1e7203515be0b030709109e9da621642dfa20312)
+---
+ src/estream.c | 25 ++++++++++++++++++++-----
+ 1 file changed, 20 insertions(+), 5 deletions(-)
+
+diff --git a/src/estream.c b/src/estream.c
+index 066fe02..cae0a69 100644
+--- a/src/estream.c
++++ b/src/estream.c
+@@ -459,17 +459,30 @@ do_list_add (estream_t stream, int with_locked_list)
+ static void
+ do_list_remove (estream_t stream, int with_locked_list)
+ {
+- estream_list_t item;
++ estream_list_t item, item_prev = NULL;
+
+ if (!with_locked_list)
+ lock_list ();
+
+ for (item = estream_list; item; item = item->next)
+ if (item->stream == stream)
+- {
+- item->stream = NULL;
+- break;
+- }
++ break;
++ else
++ item_prev = item;
++
++ if (item_prev)
++ {
++ item_prev->next = item->next;
++ mem_free (item);
++ }
++ else
++ {
++ if (item)
++ {
++ estream_list = item->next;
++ mem_free (item);
++ }
++ }
+
+ if (!with_locked_list)
+ unlock_list ();
+@@ -2233,6 +2246,8 @@ do_close (estream_t stream, int with_locked_list)
+ }
+ err = deinit_stream_obj (stream);
+ destroy_stream_lock (stream);
++ if (stream->intern->deallocate_buffer)
++ mem_free (stream->buffer);
+ mem_free (stream->intern);
+ mem_free (stream);
+ }
diff --git a/debian/patches/0006-build-Prepend-the-maintainer-CFLAGS.patch b/debian/patches/0006-build-Prepend-the-maintainer-CFLAGS.patch
new file mode 100644
index 0000000..fc842e8
--- /dev/null
+++ b/debian/patches/0006-build-Prepend-the-maintainer-CFLAGS.patch
@@ -0,0 +1,51 @@
+From: Justus Winter <justus at g10code.com>
+Date: Wed, 17 May 2017 15:41:48 +0200
+Subject: build: Prepend the maintainer CFLAGS.
+
+* configure.ac: Prepend the maintainer CFLAGS making it possible to
+override e.g. the optimization level for debugging.
+
+Signed-off-by: Justus Winter <justus at g10code.com>
+(cherry picked from commit df1d61d5c84d984fb2d2a6f1b69c57878decf13e)
+---
+ configure.ac | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 6c5a76c..e7bec39 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -234,8 +234,8 @@ if test "$GCC" = yes; then
+ # warning options and the user should have a chance of overriding
+ # them.
+ if test "$USE_MAINTAINER_MODE" = "yes"; then
+- CFLAGS="$CFLAGS -O3 -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
+- CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
++ M_CFLAGS="-O3 -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
++ M_CFLAGS="$M_CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
+ if test x"$_gcc_silent_wno" = xyes ; then
+ _gcc_wopt=yes
+ else
+@@ -248,7 +248,7 @@ if test "$GCC" = yes; then
+ CFLAGS=$_gcc_cflags_save;
+ fi
+ if test x"$_gcc_wopt" = xyes ; then
+- CFLAGS="$CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
++ M_CFLAGS="$M_CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
+ fi
+
+ AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement])
+@@ -258,8 +258,12 @@ if test "$GCC" = yes; then
+ AC_MSG_RESULT($_gcc_wopt)
+ CFLAGS=$_gcc_cflags_save;
+ if test x"$_gcc_wopt" = xyes ; then
+- CFLAGS="$CFLAGS -Wdeclaration-after-statement"
++ M_CFLAGS="$M_CFLAGS -Wdeclaration-after-statement"
+ fi
++
++ # Prepend the maintainer-cflags so that the user can override
++ # them, e.g. to override the optimization flags for debugging.
++ CFLAGS="$M_CFLAGS $CFLAGS"
+ else
+ CFLAGS="$CFLAGS -Wall"
+ fi
diff --git a/debian/patches/0007-Align-es_poll-semantics-closer-with-POSIX.patch b/debian/patches/0007-Align-es_poll-semantics-closer-with-POSIX.patch
new file mode 100644
index 0000000..9363db8
--- /dev/null
+++ b/debian/patches/0007-Align-es_poll-semantics-closer-with-POSIX.patch
@@ -0,0 +1,33 @@
+From: Justus Winter <justus at g10code.com>
+Date: Wed, 17 May 2017 15:42:34 +0200
+Subject: Align 'es_poll' semantics closer with POSIX.
+
+* src/estream.c (_gpgrt_poll): Do not return early if some streams are
+found to be ready before even polling the others.
+--
+
+POSIX mandates that all streams are examined and returning early
+violates that. It also imposes an order on how the callee serves the
+streams, which might be incompatible with the order the callee wants
+to serve them, leading to deadlocks.
+
+Signed-off-by: Justus Winter <justus at g10code.com>
+(cherry picked from commit 4a9857a2b6d8a8e847638416d35398508b3291fd)
+---
+ src/estream.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/src/estream.c b/src/estream.c
+index cae0a69..2f29cdb 100644
+--- a/src/estream.c
++++ b/src/estream.c
+@@ -4857,9 +4857,6 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout)
+ /* FIXME */
+ }
+
+- if (count)
+- goto leave; /* Early return without waiting. */
+-
+ /* Now do the real select. */
+ #ifdef HAVE_W32_SYSTEM
+
diff --git a/debian/patches/series b/debian/patches/series
index c9217df..9d2bce0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,7 @@
0001-Remove-upstream-git-fanciness.patch
0002-avoid-whitespace-in-gpg-error.def-linker-script-for-.patch
+0003-w32-Conditionalize-ISO-2022-definitions.patch
+0004-Minor-clean-up.patch
+0005-Fix-memory-leak-for-estream.patch
+0006-build-Prepend-the-maintainer-CFLAGS.patch
+0007-Align-es_poll-semantics-closer-with-POSIX.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libgpg-error.git
More information about the Pkg-gnupg-commit
mailing list