Gentoo Archives: gentoo-commits

From: Sebastian Pipping <sping@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/giflib/files/, media-libs/giflib/
Date: Fri, 23 Mar 2018 23:26:56
Message-Id: 1521847590.010e1c17d6268e0747b362d3ba81f1e17d9b9f9d.sping@gentoo
1 commit: 010e1c17d6268e0747b362d3ba81f1e17d9b9f9d
2 Author: Sebastian Pipping <sping <AT> gentoo <DOT> org>
3 AuthorDate: Fri Mar 23 22:49:06 2018 +0000
4 Commit: Sebastian Pipping <sping <AT> gentoo <DOT> org>
5 CommitDate: Fri Mar 23 23:26:30 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=010e1c17
7
8 media-libs/giflib: Fix reallocarray export collision
9
10 Closes: https://bugs.gentoo.org/637438
11 Package-Manager: Portage-2.3.24, Repoman-2.3.6
12
13 .../files/giflib-5.1.4-reallocarray-export.patch | 129 +++++++++++++++++++++
14 media-libs/giflib/giflib-5.1.4-r1.ebuild | 75 ++++++++++++
15 2 files changed, 204 insertions(+)
16
17 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
18 new file mode 100644
19 index 00000000000..08d4f3d3d4e
20 --- /dev/null
21 +++ b/media-libs/giflib/files/giflib-5.1.4-reallocarray-export.patch
22 @@ -0,0 +1,129 @@
23 +From 9805c76d4f76c77aad9f285e81f4090cdf661fac Mon Sep 17 00:00:00 2001
24 +From: Sebastian Pipping <sebastian@×××××××.org>
25 +Date: Wed, 14 Mar 2018 21:18:14 +0100
26 +Subject: [PATCH] Address clash of export reallocarray with glibc
27 +MIME-Version: 1.0
28 +Content-Type: text/plain; charset=UTF-8
29 +Content-Transfer-Encoding: 8bit
30 +
31 +.. by not exporting that internal symbol any more,
32 +and renaming the function in code and where it's used
33 +
34 +Bug: https://bugs.gentoo.org/637438
35 +
36 +Compile error was:
37 +
38 +/usr/include/gif_lib.h:248:51: error: declaration of ‘void* reallocarray(void*, size_t, size_t)’ has a different exception specifier
39 + reallocarray(void *optr, size_t nmemb, size_t size);
40 + ^
41 +[..]
42 +/usr/include/stdlib.h:443:14: error: from previous declaration ‘void* reallocarray(void*, size_t, size_t) throw ()’
43 + extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
44 +---
45 + lib/dgif_lib.c | 4 ++--
46 + lib/gif_lib.h | 3 ---
47 + lib/gifalloc.c | 10 +++++-----
48 + lib/openbsd-reallocarray.c | 2 +-
49 + 4 files changed, 8 insertions(+), 11 deletions(-)
50 +
51 +diff --git a/lib/dgif_lib.c b/lib/dgif_lib.c
52 +index 66a1d6a..f0e0385 100644
53 +--- a/lib/dgif_lib.c
54 ++++ b/lib/dgif_lib.c
55 +@@ -396,7 +396,7 @@ DGifGetImageDesc(GifFileType *GifFile)
56 +
57 + if (GifFile->SavedImages) {
58 + SavedImage* new_saved_images =
59 +- (SavedImage *)reallocarray(GifFile->SavedImages,
60 ++ (SavedImage *)openbsd_reallocarray(GifFile->SavedImages,
61 + (GifFile->ImageCount + 1), sizeof(SavedImage));
62 + if (new_saved_images == NULL) {
63 + GifFile->Error = D_GIF_ERR_NOT_ENOUGH_MEM;
64 +@@ -1108,7 +1108,7 @@ DGifSlurp(GifFileType *GifFile)
65 + if (ImageSize > (SIZE_MAX / sizeof(GifPixelType))) {
66 + return GIF_ERROR;
67 + }
68 +- sp->RasterBits = (unsigned char *)reallocarray(NULL, ImageSize,
69 ++ sp->RasterBits = (unsigned char *)openbsd_reallocarray(NULL, ImageSize,
70 + sizeof(GifPixelType));
71 +
72 + if (sp->RasterBits == NULL) {
73 +diff --git a/lib/gif_lib.h b/lib/gif_lib.h
74 +index 078930c..7914a69 100644
75 +--- a/lib/gif_lib.h
76 ++++ b/lib/gif_lib.h
77 +@@ -244,9 +244,6 @@ extern ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1,
78 + GifPixelType ColorTransIn2[]);
79 + extern int GifBitSize(int n);
80 +
81 +-extern void *
82 +-reallocarray(void *optr, size_t nmemb, size_t size);
83 +-
84 + /******************************************************************************
85 + Support for the in-core structures allocation (slurp mode).
86 + ******************************************************************************/
87 +diff --git a/lib/gifalloc.c b/lib/gifalloc.c
88 +index 3b51868..1394cfa 100644
89 +--- a/lib/gifalloc.c
90 ++++ b/lib/gifalloc.c
91 +@@ -188,7 +188,7 @@ GifUnionColorMap(const ColorMapObject *ColorIn1,
92 +
93 + /* perhaps we can shrink the map? */
94 + if (RoundUpTo < ColorUnion->ColorCount) {
95 +- GifColorType *new_map = (GifColorType *)reallocarray(Map,
96 ++ GifColorType *new_map = (GifColorType *)openbsd_reallocarray(Map,
97 + RoundUpTo, sizeof(GifColorType));
98 + if( new_map == NULL ) {
99 + GifFreeMapObject(ColorUnion);
100 +@@ -232,7 +232,7 @@ GifAddExtensionBlock(int *ExtensionBlockCount,
101 + if (*ExtensionBlocks == NULL)
102 + *ExtensionBlocks=(ExtensionBlock *)malloc(sizeof(ExtensionBlock));
103 + else {
104 +- ExtensionBlock* ep_new = (ExtensionBlock *)reallocarray
105 ++ ExtensionBlock* ep_new = (ExtensionBlock *)openbsd_reallocarray
106 + (*ExtensionBlocks, (*ExtensionBlockCount + 1),
107 + sizeof(ExtensionBlock));
108 + if( ep_new == NULL )
109 +@@ -325,7 +325,7 @@ GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom)
110 + if (GifFile->SavedImages == NULL)
111 + GifFile->SavedImages = (SavedImage *)malloc(sizeof(SavedImage));
112 + else
113 +- GifFile->SavedImages = (SavedImage *)reallocarray(GifFile->SavedImages,
114 ++ GifFile->SavedImages = (SavedImage *)openbsd_reallocarray(GifFile->SavedImages,
115 + (GifFile->ImageCount + 1), sizeof(SavedImage));
116 +
117 + if (GifFile->SavedImages == NULL)
118 +@@ -355,7 +355,7 @@ GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom)
119 + }
120 +
121 + /* next, the raster */
122 +- sp->RasterBits = (unsigned char *)reallocarray(NULL,
123 ++ sp->RasterBits = (unsigned char *)openbsd_reallocarray(NULL,
124 + (CopyFrom->ImageDesc.Height *
125 + CopyFrom->ImageDesc.Width),
126 + sizeof(GifPixelType));
127 +@@ -369,7 +369,7 @@ GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom)
128 +
129 + /* finally, the extension blocks */
130 + if (sp->ExtensionBlocks != NULL) {
131 +- sp->ExtensionBlocks = (ExtensionBlock *)reallocarray(NULL,
132 ++ sp->ExtensionBlocks = (ExtensionBlock *)openbsd_reallocarray(NULL,
133 + CopyFrom->ExtensionBlockCount,
134 + sizeof(ExtensionBlock));
135 + if (sp->ExtensionBlocks == NULL) {
136 +diff --git a/lib/openbsd-reallocarray.c b/lib/openbsd-reallocarray.c
137 +index aa70686..b922b01 100644
138 +--- a/lib/openbsd-reallocarray.c
139 ++++ b/lib/openbsd-reallocarray.c
140 +@@ -27,7 +27,7 @@
141 + #define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
142 +
143 + void *
144 +-reallocarray(void *optr, size_t nmemb, size_t size)
145 ++openbsd_reallocarray(void *optr, size_t nmemb, size_t size)
146 + {
147 + if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
148 + nmemb > 0 && SIZE_MAX / nmemb < size) {
149 +--
150 +2.16.2
151 +
152
153 diff --git a/media-libs/giflib/giflib-5.1.4-r1.ebuild b/media-libs/giflib/giflib-5.1.4-r1.ebuild
154 new file mode 100644
155 index 00000000000..a5fce8fa5fe
156 --- /dev/null
157 +++ b/media-libs/giflib/giflib-5.1.4-r1.ebuild
158 @@ -0,0 +1,75 @@
159 +# Copyright 1999-2018 Gentoo Foundation
160 +# Distributed under the terms of the GNU General Public License v2
161 +
162 +EAPI=6
163 +
164 +inherit eutils libtool multilib-minimal
165 +
166 +DESCRIPTION="Library to handle, display and manipulate GIF images"
167 +HOMEPAGE="https://sourceforge.net/projects/giflib/"
168 +SRC_URI="mirror://sourceforge/giflib/${P}.tar.bz2"
169 +
170 +LICENSE="MIT"
171 +SLOT="0/7"
172 +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"
173 +IUSE="doc static-libs"
174 +
175 +RDEPEND="
176 + abi_x86_32? (
177 + !<=app-emulation/emul-linux-x86-baselibs-20140406-r1
178 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32]
179 + )"
180 +DEPEND="${RDEPEND}
181 + doc? ( app-text/xmlto )"
182 +
183 +PATCHES=(
184 + "${FILESDIR}"/${P}-reallocarray-export.patch
185 +)
186 +
187 +src_prepare() {
188 + default
189 + elibtoolize
190 +}
191 +
192 +multilib_src_configure() {
193 + local myeconfargs=(
194 + # No need for xmlto as they ship generated files.
195 + ac_cv_prog_have_xmlto=no
196 +
197 + $(use_enable static-libs static)
198 + )
199 +
200 + ECONF_SOURCE="${S}" \
201 + econf "${myeconfargs[@]}"
202 +}
203 +
204 +multilib_src_compile() {
205 + default
206 +
207 + if use doc && multilib_is_native_abi; then
208 + emake -C doc
209 + fi
210 +}
211 +
212 +multilib_src_install() {
213 + default
214 +
215 + # for static libs the .la file is required if built with +X
216 + use static-libs || prune_libtool_files --all
217 +
218 + if use doc && multilib_is_native_abi; then
219 + docinto html
220 + dodoc doc/*.html
221 + fi
222 +}
223 +
224 +multilib_src_install_all() {
225 + doman doc/*.1
226 + docinto
227 + dodoc AUTHORS BUGS ChangeLog NEWS README TODO
228 + if use doc; then
229 + dodoc doc/*.txt
230 + docinto html
231 + dodoc -r doc/whatsinagif
232 + fi
233 +}