public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sebastian Pipping" <sping@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/giflib/files/, media-libs/giflib/
Date: Fri, 23 Mar 2018 23:26:52 +0000 (UTC)	[thread overview]
Message-ID: <1521847590.010e1c17d6268e0747b362d3ba81f1e17d9b9f9d.sping@gentoo> (raw)

commit:     010e1c17d6268e0747b362d3ba81f1e17d9b9f9d
Author:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 23 22:49:06 2018 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Fri Mar 23 23:26:30 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=010e1c17

media-libs/giflib: Fix reallocarray export collision

Closes: https://bugs.gentoo.org/637438
Package-Manager: Portage-2.3.24, Repoman-2.3.6

 .../files/giflib-5.1.4-reallocarray-export.patch   | 129 +++++++++++++++++++++
 media-libs/giflib/giflib-5.1.4-r1.ebuild           |  75 ++++++++++++
 2 files changed, 204 insertions(+)

diff --git a/media-libs/giflib/files/giflib-5.1.4-reallocarray-export.patch b/media-libs/giflib/files/giflib-5.1.4-reallocarray-export.patch
new file mode 100644
index 00000000000..08d4f3d3d4e
--- /dev/null
+++ b/media-libs/giflib/files/giflib-5.1.4-reallocarray-export.patch
@@ -0,0 +1,129 @@
+From 9805c76d4f76c77aad9f285e81f4090cdf661fac Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <sebastian@pipping.org>
+Date: Wed, 14 Mar 2018 21:18:14 +0100
+Subject: [PATCH] Address clash of export reallocarray with glibc
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+.. by not exporting that internal symbol any more,
+and renaming the function in code and where it's used
+
+Bug: https://bugs.gentoo.org/637438
+
+Compile error was:
+
+/usr/include/gif_lib.h:248:51: error: declaration of ‘void* reallocarray(void*, size_t, size_t)’ has a different exception specifier
+ reallocarray(void *optr, size_t nmemb, size_t size);
+                                                   ^
+[..]
+/usr/include/stdlib.h:443:14: error: from previous declaration ‘void* reallocarray(void*, size_t, size_t) throw ()’
+ extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
+---
+ lib/dgif_lib.c             |  4 ++--
+ lib/gif_lib.h              |  3 ---
+ lib/gifalloc.c             | 10 +++++-----
+ lib/openbsd-reallocarray.c |  2 +-
+ 4 files changed, 8 insertions(+), 11 deletions(-)
+
+diff --git a/lib/dgif_lib.c b/lib/dgif_lib.c
+index 66a1d6a..f0e0385 100644
+--- a/lib/dgif_lib.c
++++ b/lib/dgif_lib.c
+@@ -396,7 +396,7 @@ DGifGetImageDesc(GifFileType *GifFile)
+ 
+     if (GifFile->SavedImages) {
+         SavedImage* new_saved_images =
+-            (SavedImage *)reallocarray(GifFile->SavedImages,
++            (SavedImage *)openbsd_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 @@ DGifSlurp(GifFileType *GifFile)
+               if (ImageSize > (SIZE_MAX / sizeof(GifPixelType))) {
+                   return GIF_ERROR;
+               }
+-              sp->RasterBits = (unsigned char *)reallocarray(NULL, ImageSize,
++              sp->RasterBits = (unsigned char *)openbsd_reallocarray(NULL, ImageSize,
+                       sizeof(GifPixelType));
+ 
+               if (sp->RasterBits == NULL) {
+diff --git a/lib/gif_lib.h b/lib/gif_lib.h
+index 078930c..7914a69 100644
+--- a/lib/gif_lib.h
++++ b/lib/gif_lib.h
+@@ -244,9 +244,6 @@ extern ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1,
+                                      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 --git a/lib/gifalloc.c b/lib/gifalloc.c
+index 3b51868..1394cfa 100644
+--- a/lib/gifalloc.c
++++ b/lib/gifalloc.c
+@@ -188,7 +188,7 @@ GifUnionColorMap(const ColorMapObject *ColorIn1,
+ 
+         /* perhaps we can shrink the map? */
+         if (RoundUpTo < ColorUnion->ColorCount) {
+-            GifColorType *new_map = (GifColorType *)reallocarray(Map,
++            GifColorType *new_map = (GifColorType *)openbsd_reallocarray(Map,
+                                  RoundUpTo, sizeof(GifColorType));
+             if( new_map == NULL ) {
+                 GifFreeMapObject(ColorUnion);
+@@ -232,7 +232,7 @@ GifAddExtensionBlock(int *ExtensionBlockCount,
+     if (*ExtensionBlocks == NULL)
+         *ExtensionBlocks=(ExtensionBlock *)malloc(sizeof(ExtensionBlock));
+     else {
+-        ExtensionBlock* ep_new = (ExtensionBlock *)reallocarray
++        ExtensionBlock* ep_new = (ExtensionBlock *)openbsd_reallocarray
+ 				 (*ExtensionBlocks, (*ExtensionBlockCount + 1),
+                                       sizeof(ExtensionBlock));
+         if( ep_new == NULL )
+@@ -325,7 +325,7 @@ GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom)
+     if (GifFile->SavedImages == NULL)
+         GifFile->SavedImages = (SavedImage *)malloc(sizeof(SavedImage));
+     else
+-        GifFile->SavedImages = (SavedImage *)reallocarray(GifFile->SavedImages,
++        GifFile->SavedImages = (SavedImage *)openbsd_reallocarray(GifFile->SavedImages,
+                                (GifFile->ImageCount + 1), sizeof(SavedImage));
+ 
+     if (GifFile->SavedImages == NULL)
+@@ -355,7 +355,7 @@ GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom)
+             }
+ 
+             /* next, the raster */
+-            sp->RasterBits = (unsigned char *)reallocarray(NULL,
++            sp->RasterBits = (unsigned char *)openbsd_reallocarray(NULL,
+                                                   (CopyFrom->ImageDesc.Height *
+                                                   CopyFrom->ImageDesc.Width),
+ 						  sizeof(GifPixelType));
+@@ -369,7 +369,7 @@ GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom)
+ 
+             /* finally, the extension blocks */
+             if (sp->ExtensionBlocks != NULL) {
+-                sp->ExtensionBlocks = (ExtensionBlock *)reallocarray(NULL,
++                sp->ExtensionBlocks = (ExtensionBlock *)openbsd_reallocarray(NULL,
+                                       CopyFrom->ExtensionBlockCount,
+ 				      sizeof(ExtensionBlock));
+                 if (sp->ExtensionBlocks == NULL) {
+diff --git a/lib/openbsd-reallocarray.c b/lib/openbsd-reallocarray.c
+index aa70686..b922b01 100644
+--- a/lib/openbsd-reallocarray.c
++++ b/lib/openbsd-reallocarray.c
+@@ -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)
++openbsd_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.16.2
+

diff --git a/media-libs/giflib/giflib-5.1.4-r1.ebuild b/media-libs/giflib/giflib-5.1.4-r1.ebuild
new file mode 100644
index 00000000000..a5fce8fa5fe
--- /dev/null
+++ b/media-libs/giflib/giflib-5.1.4-r1.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils libtool multilib-minimal
+
+DESCRIPTION="Library to handle, display and manipulate GIF images"
+HOMEPAGE="https://sourceforge.net/projects/giflib/"
+SRC_URI="mirror://sourceforge/giflib/${P}.tar.bz2"
+
+LICENSE="MIT"
+SLOT="0/7"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="doc static-libs"
+
+RDEPEND="
+	abi_x86_32? (
+		!<=app-emulation/emul-linux-x86-baselibs-20140406-r1
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32]
+	)"
+DEPEND="${RDEPEND}
+	doc? ( app-text/xmlto )"
+
+PATCHES=(
+	"${FILESDIR}"/${P}-reallocarray-export.patch
+)
+
+src_prepare() {
+	default
+	elibtoolize
+}
+
+multilib_src_configure() {
+	local myeconfargs=(
+		# No need for xmlto as they ship generated files.
+		ac_cv_prog_have_xmlto=no
+
+		$(use_enable static-libs static)
+	)
+
+	ECONF_SOURCE="${S}" \
+	econf "${myeconfargs[@]}"
+}
+
+multilib_src_compile() {
+	default
+
+	if use doc && multilib_is_native_abi; then
+		emake -C doc
+	fi
+}
+
+multilib_src_install() {
+	default
+
+	# for static libs the .la file is required if built with +X
+	use static-libs || prune_libtool_files --all
+
+	if use doc && multilib_is_native_abi; then
+		docinto html
+		dodoc doc/*.html
+	fi
+}
+
+multilib_src_install_all() {
+	doman doc/*.1
+	docinto
+	dodoc AUTHORS BUGS ChangeLog NEWS README TODO
+	if use doc; then
+		dodoc doc/*.txt
+		docinto html
+		dodoc -r doc/whatsinagif
+	fi
+}


             reply	other threads:[~2018-03-23 23:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 23:26 Sebastian Pipping [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-03-17 20:07 [gentoo-commits] repo/gentoo:master commit in: media-libs/giflib/files/, media-libs/giflib/ Lars Wendler
2019-03-17 20:07 Lars Wendler
2019-03-18  7:32 Lars Wendler
2019-03-29 17:11 Lars Wendler
2019-12-23 23:20 David Seifert
2024-05-30  3:54 Sam James

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1521847590.010e1c17d6268e0747b362d3ba81f1e17d9b9f9d.sping@gentoo \
    --to=sping@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox