From: Hartmut Goebel <h.goebel@crazy-compilers.com>
To: 30654@debbugs.gnu.org
Subject: [bug#30654] [PATCH v2 1/1] gnu: giflib: Make "reallocarray" private, solve glibc@2.26 conflict.
Date: Wed, 28 Feb 2018 22:46:48 +0100 [thread overview]
Message-ID: <20180228214648.7996-1-h.goebel@crazy-compilers.com> (raw)
In-Reply-To: <20180228201202.1481-1-h.goebel@crazy-compilers.com>
Rename the function and move the declaration from gif_lib.h to
gif_lib_private.h to solve conflicts when some .c-file #includes
both stdlib.h and gif_lib.h.
See also https://sourceforge.net/p/giflib/bugs/110/
* gnu/packages/patches/giflib-make-reallocarray-private.patch: New
file
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/image.scm(giflib)[source](patches): New field.
---
gnu/local.mk | 1 +
gnu/packages/image.scm | 4 +-
.../patches/giflib-make-reallocarray-private.patch | 120 +++++++++++++++++++++
3 files changed, 124 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/giflib-make-reallocarray-private.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 24368727f..de8161bbb 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -693,6 +693,7 @@ dist_patch_DATA = \
%D%/packages/patches/ghostscript-no-header-uuid.patch \
%D%/packages/patches/ghostscript-no-header-creationdate.patch \
%D%/packages/patches/ghostscript-runpath.patch \
+ %D%/packages/patches/giflib-make-reallocarray-private.patch \
%D%/packages/patches/gimp-CVE-2017-17784.patch \
%D%/packages/patches/gimp-CVE-2017-17785.patch \
%D%/packages/patches/gimp-CVE-2017-17786.patch \
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index e3e3a3ccc..a39718903 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -572,7 +572,9 @@ error-resilience, a Java-viewer for j2k-images, ...")
version ".tar.bz2"))
(sha256
(base32
- "1md83dip8rf29y40cm5r7nn19705f54iraz6545zhwa6y8zyq9yz"))))
+ "1md83dip8rf29y40cm5r7nn19705f54iraz6545zhwa6y8zyq9yz"))
+ (patches (search-patches
+ "giflib-make-reallocarray-private.patch"))))
(build-system gnu-build-system)
(outputs '("bin" ; utility programs
"out")) ; library
diff --git a/gnu/packages/patches/giflib-make-reallocarray-private.patch b/gnu/packages/patches/giflib-make-reallocarray-private.patch
new file mode 100644
index 000000000..69228c5be
--- /dev/null
+++ b/gnu/packages/patches/giflib-make-reallocarray-private.patch
@@ -0,0 +1,120 @@
+Move the declaration from gif_lib.h to gif_lib_private.h to solve
+conflicts when some .c-file #includes both stdlib.h and gif_lib.h.
+See also https://sourceforge.net/p/giflib/bugs/110/
+
+diff -ur giflib-5.1.4.orig/lib/dgif_lib.c giflib-5.1.4/lib/dgif_lib.c
+--- giflib-5.1.4.orig/lib/dgif_lib.c 2018-02-28 20:31:02.294682673 +0100
++++ giflib-5.1.4/lib/dgif_lib.c 2018-02-28 22:38:11.659126414 +0100
+@@ -396,7 +396,7 @@
+
+ if (GifFile->SavedImages) {
+ SavedImage* new_saved_images =
+- (SavedImage *)reallocarray(GifFile->SavedImages,
++ (SavedImage *)giflib_private_reallocarray(GifFile->SavedImages,
+ (GifFile->ImageCount + 1), sizeof(SavedImage));
+ if (new_saved_images == NULL) {
+ GifFile->Error = D_GIF_ERR_NOT_ENOUGH_MEM;
+@@ -1108,7 +1108,7 @@
+ if (ImageSize > (SIZE_MAX / sizeof(GifPixelType))) {
+ return GIF_ERROR;
+ }
+- sp->RasterBits = (unsigned char *)reallocarray(NULL, ImageSize,
++ sp->RasterBits = (unsigned char *)giflib_private_reallocarray(NULL, ImageSize,
+ sizeof(GifPixelType));
+
+ if (sp->RasterBits == NULL) {
+diff -ur giflib-5.1.4.orig/lib/gifalloc.c giflib-5.1.4/lib/gifalloc.c
+--- giflib-5.1.4.orig/lib/gifalloc.c 2018-02-28 20:31:02.294682673 +0100
++++ giflib-5.1.4/lib/gifalloc.c 2018-02-28 22:38:11.657126423 +0100
+@@ -8,7 +8,7 @@
+ #include <stdio.h>
+ #include <string.h>
+
+-#include "gif_lib.h"
++#include "gif_lib_private.h"
+
+ #define MAX(x, y) (((x) > (y)) ? (x) : (y))
+
+@@ -188,7 +188,7 @@
+
+ /* perhaps we can shrink the map? */
+ if (RoundUpTo < ColorUnion->ColorCount) {
+- GifColorType *new_map = (GifColorType *)reallocarray(Map,
++ GifColorType *new_map = (GifColorType *)giflib_private_reallocarray(Map,
+ RoundUpTo, sizeof(GifColorType));
+ if( new_map == NULL ) {
+ GifFreeMapObject(ColorUnion);
+@@ -232,7 +232,7 @@
+ if (*ExtensionBlocks == NULL)
+ *ExtensionBlocks=(ExtensionBlock *)malloc(sizeof(ExtensionBlock));
+ else {
+- ExtensionBlock* ep_new = (ExtensionBlock *)reallocarray
++ ExtensionBlock* ep_new = (ExtensionBlock *)giflib_private_reallocarray
+ (*ExtensionBlocks, (*ExtensionBlockCount + 1),
+ sizeof(ExtensionBlock));
+ if( ep_new == NULL )
+@@ -325,7 +325,7 @@
+ if (GifFile->SavedImages == NULL)
+ GifFile->SavedImages = (SavedImage *)malloc(sizeof(SavedImage));
+ else
+- GifFile->SavedImages = (SavedImage *)reallocarray(GifFile->SavedImages,
++ GifFile->SavedImages = (SavedImage *)giflib_private_reallocarray(GifFile->SavedImages,
+ (GifFile->ImageCount + 1), sizeof(SavedImage));
+
+ if (GifFile->SavedImages == NULL)
+@@ -355,7 +355,7 @@
+ }
+
+ /* next, the raster */
+- sp->RasterBits = (unsigned char *)reallocarray(NULL,
++ sp->RasterBits = (unsigned char *)giflib_private_reallocarray(NULL,
+ (CopyFrom->ImageDesc.Height *
+ CopyFrom->ImageDesc.Width),
+ sizeof(GifPixelType));
+@@ -369,7 +369,7 @@
+
+ /* finally, the extension blocks */
+ if (sp->ExtensionBlocks != NULL) {
+- sp->ExtensionBlocks = (ExtensionBlock *)reallocarray(NULL,
++ sp->ExtensionBlocks = (ExtensionBlock *)giflib_private_reallocarray(NULL,
+ CopyFrom->ExtensionBlockCount,
+ sizeof(ExtensionBlock));
+ if (sp->ExtensionBlocks == NULL) {
+diff -ur giflib-5.1.4.orig/lib/gif_lib.h giflib-5.1.4/lib/gif_lib.h
+--- giflib-5.1.4.orig/lib/gif_lib.h 2018-02-28 20:31:02.294682673 +0100
++++ giflib-5.1.4/lib/gif_lib.h 2018-02-28 20:31:43.135716712 +0100
+@@ -244,9 +244,6 @@
+ GifPixelType ColorTransIn2[]);
+ extern int GifBitSize(int n);
+
+-extern void *
+-reallocarray(void *optr, size_t nmemb, size_t size);
+-
+ /******************************************************************************
+ Support for the in-core structures allocation (slurp mode).
+ ******************************************************************************/
+diff -ur giflib-5.1.4.orig/lib/gif_lib_private.h giflib-5.1.4/lib/gif_lib_private.h
+--- giflib-5.1.4.orig/lib/gif_lib_private.h 2018-02-28 20:31:02.294682673 +0100
++++ giflib-5.1.4/lib/gif_lib_private.h 2018-02-28 22:38:11.657126423 +0100
+@@ -54,6 +54,9 @@
+ bool gif89;
+ } GifFilePrivateType;
+
++extern void *
++giflib_private_reallocarray(void *optr, size_t nmemb, size_t size);
++
+ #endif /* _GIF_LIB_PRIVATE_H */
+
+ /* end */
+diff -ur giflib-5.1.4.orig/lib/openbsd-reallocarray.c giflib-5.1.4/lib/openbsd-reallocarray.c
+--- giflib-5.1.4.orig/lib/openbsd-reallocarray.c 2018-02-28 20:31:02.295682659 +0100
++++ giflib-5.1.4/lib/openbsd-reallocarray.c 2018-02-28 22:38:11.656126428 +0100
+@@ -27,7 +27,7 @@
+ #define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
+
+ void *
+-reallocarray(void *optr, size_t nmemb, size_t size)
++giflib_private_reallocarray(void *optr, size_t nmemb, size_t size)
+ {
+ if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
+ nmemb > 0 && SIZE_MAX / nmemb < size) {
--
2.13.6
next prev parent reply other threads:[~2018-02-28 21:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-28 20:12 [bug#30654] [PATCH 1/1] gnu: giflib: Make "reallocarray" private, solve glibc@2.26 conflict Hartmut Goebel
2018-02-28 20:16 ` [bug#30654] giflib / khtml build failures Hartmut Goebel
2018-02-28 21:57 ` Danny Milosavljevic
2018-02-28 21:06 ` Hartmut Goebel
2018-02-28 22:18 ` Danny Milosavljevic
2018-02-28 22:10 ` Danny Milosavljevic
2018-02-28 21:46 ` Hartmut Goebel [this message]
2018-03-01 4:01 ` [bug#30654] [PATCH v2 1/1] gnu: giflib: Make "reallocarray" private, solve glibc@2.26 conflict Danny Milosavljevic
2018-03-01 7:52 ` Hartmut Goebel
2018-03-17 17:29 ` Manolis Ragkousis
2018-03-17 20:58 ` Hartmut Goebel
2018-06-22 15:37 ` bug#30654: " Gábor Boskovits
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180228214648.7996-1-h.goebel@crazy-compilers.com \
--to=h.goebel@crazy-compilers.com \
--cc=30654@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).