[gentoo-commits] repo/gentoo:master commit in: media-libs/libafterimage/files/, media-libs/libafterimage/

2017-01-17 Thread Andrew Savchenko
commit: 1565ff5da7b321093f3b6e72597bee214c7c08f2
Author: Andrew Savchenko  gentoo  org>
AuthorDate: Tue Jan 17 22:35:23 2017 +
Commit: Andrew Savchenko  gentoo  org>
CommitDate: Tue Jan 17 22:35:23 2017 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1565ff5d

media-libs/libafterimage: fix invalid casts, see bug 571654

Fix invalid pointer usage as pointed out by Oliver Freyermuth
 googlemail.com>, bug 571654, comment 23 which may
lead to ROOT crash (comment 22).
Patch by  Oliver Freyermuth, comment 24.

Also fix pointer signedness issue in import.c:2227.

Package-Manager: Portage-2.3.3, Repoman-2.3.1
Signed-off-by: Andrew Savchenko  gentoo.org>

 .../files/libafterimage-giflib5-v2.patch   | 391 +
 .../libafterimage/libafterimage-1.20-r2.ebuild | 108 ++
 2 files changed, 499 insertions(+)

diff --git a/media-libs/libafterimage/files/libafterimage-giflib5-v2.patch 
b/media-libs/libafterimage/files/libafterimage-giflib5-v2.patch
new file mode 100644
index ..85afd53
--- /dev/null
+++ b/media-libs/libafterimage/files/libafterimage-giflib5-v2.patch
@@ -0,0 +1,391 @@
+diff -Naurd libAfterImage-1.20.orig/export.c libAfterImage-1.20/export.c
+--- libAfterImage-1.20.orig/export.c   2016-05-01 11:44:19.0 +0300
 libAfterImage-1.20/export.c2016-05-02 10:57:59.688984491 +0300
+@@ -1048,6 +1048,9 @@
+   Bool new_image = True ;
+   START_TIME(started);
+   int cmap_size = 1;
++#if (GIFLIB_MAJOR>=5)
++  int errcode;
++#endif
+ #define GIF_NETSCAPE_EXT_BYTES 3
+   unsigned char netscape_ext_bytes[GIF_NETSCAPE_EXT_BYTES] = { 0x1, 0x0, 
0x0};
+ #define GIF_GCE_BYTES 4   
+@@ -1086,10 +1089,18 @@
+ 
+   while( cmap_size < 256 && cmap_size < 
(int)cmap.count+(gce_bytes[0]&0x01) )
+   cmap_size = cmap_size<<1 ;
++#if (GIFLIB_MAJOR>=5)
++  if( (gif_cmap = GifMakeMapObject(cmap_size, NULL )) == NULL )
++#else
+   if( (gif_cmap = MakeMapObject(cmap_size, NULL )) == NULL )
++#endif
+   {
+   free( mapped_im );
++#if (GIFLIB_MAJOR>=5)
++  ASIM_PrintGifError(E_GIF_ERR_NOT_ENOUGH_MEM);
++#else
+   ASIM_PrintGifError();
++#endif
+   return False;
+   }
+   memcpy( &(gif_cmap->Colors[0]), &(cmap.entries[0]), 
MIN(cmap.count,(unsigned int)cmap_size)*3 );
+@@ -1101,13 +1112,25 @@
+   SavedImage *images = NULL ;
+   int count = 0 ;
+   /* TODO: do something about multiimage files !!! */
++#if (GIFLIB_MAJOR>=5)
++  gif = open_gif_read(infile, &errcode);
++#else
+   gif = open_gif_read(infile);
++#endif
+   if( gif == NULL || get_gif_saved_images(gif, -1, &images, 
&count) == GIF_ERROR)
+   {
++#if (GIFLIB_MAJOR>=5)
++  ASIM_PrintGifError(errcode);
++#else
+   ASIM_PrintGifError();
++#endif
+   if( gif )
+   {
++#if (GIFLIB_MAJOR>=5)
++  DGifCloseFile(gif, &errcode);
++#else
+   DGifCloseFile(gif);
++#endif
+   gif = NULL ;
+   }
+   if (infile)
+@@ -1123,14 +1146,22 @@
+   gif_src = *gif ;
+   gif->SColorMap = NULL ;
+   gif->Image.ColorMap = NULL ;
++#if (GIFLIB_MAJOR>=5)
++DGifCloseFile(gif, &errcode);
++#else
+   DGifCloseFile(gif);
++#endif
+   gif = NULL;
+   fclose (infile);
+   infile = NULL;
+   outfile = open_writeable_image_file( path );
+ 
+   if (outfile)
++#if (GIFLIB_MAJOR>=5)
++  gif = EGifOpenFileHandle(fileno(outfile), 
&errcode);
++#else
+   gif = EGifOpenFileHandle(fileno(outfile));
++#endif
+   
+   if (gif)
+   {
+@@ -1141,26 +1172,46 @@
+  
gif_src.SColorMap )) == GIF_OK )
+   status = write_gif_saved_images( gif, 
images, count );
+   if( status != GIF_OK )
++#if (GIFLIB_MAJOR>=5)
++  ASIM_PrintGifError(status);
++#else
+   ASIM_PrintGifError();
++#endif
+   }
+   if (gif_src.SColorMap)
+   {  /* we only want to save private colormap if it is 
any different from
+   * screen colormap ( saves us  768 bytes per image ) 
*/
+   if( gif_cmap->ColorCount == 
gif_src.SColorMap->ColorCount )
+   dont_save_cmap = ( memcmp( 
gif_cmap->Colors, gif_src.SColorMap->Colors, 
gif_cmap

[gentoo-commits] repo/gentoo:master commit in: media-libs/libafterimage/files/

2016-05-08 Thread Andrew Savchenko
commit: bc04ac3d16115fd75cfa89b3907bec80c3499359
Author: Andrew Savchenko  gentoo  org>
AuthorDate: Sun May  8 07:21:08 2016 +
Commit: Andrew Savchenko  gentoo  org>
CommitDate: Sun May  8 07:21:08 2016 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bc04ac3d

media-libs/libafterimage: fix bug 582308

libjpeg provides some macro that were removed in >=giflib-5, so
with USE="gif -jpeg" and >=giflib-5 we had undefined TRUE and
FALSE.

Package-Manager: portage-2.2.28
Signed-off-by: Andrew Savchenko  gentoo.org>

 media-libs/libafterimage/files/libafterimage-giflib5.patch | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/media-libs/libafterimage/files/libafterimage-giflib5.patch 
b/media-libs/libafterimage/files/libafterimage-giflib5.patch
index 32037d9..b650b24 100644
--- a/media-libs/libafterimage/files/libafterimage-giflib5.patch
+++ b/media-libs/libafterimage/files/libafterimage-giflib5.patch
@@ -117,7 +117,7 @@ diff -Naurd libAfterImage-1.20.orig/export.c 
libAfterImage-1.20/export.c
}

 +#if (GIFLIB_MAJOR>=5)
-+  if( (errcode = EGifPutImageDesc(gif, 0, 0, 
im->width, im->height, FALSE, (dont_save_cmap)?NULL:gif_cmap )) == GIF_ERROR )
++  if( (errcode = EGifPutImageDesc(gif, 0, 0, 
im->width, im->height, false, (dont_save_cmap)?NULL:gif_cmap )) == GIF_ERROR )
 +  ASIM_PrintGifError(errcode);
 +#else
if( EGifPutImageDesc(gif, 0, 0, im->width, 
im->height, FALSE, (dont_save_cmap)?NULL:gif_cmap ) == GIF_ERROR )
@@ -155,7 +155,7 @@ diff -Naurd libAfterImage-1.20.orig/export.c 
libAfterImage-1.20/export.c
EGifPutExtension(gif, 0xf9, GIF_GCE_BYTES, &(gce_bytes[0]));

 +#if (GIFLIB_MAJOR>=5)
-+  if( (errcode = EGifPutImageDesc(gif, 0, 0, im->width, 
im->height, FALSE, NULL )) == GIF_ERROR )
++  if( (errcode = EGifPutImageDesc(gif, 0, 0, im->width, 
im->height, false, NULL )) == GIF_ERROR )
 +  ASIM_PrintGifError(errcode);
 +#else
if( EGifPutImageDesc(gif, 0, 0, im->width, im->height, FALSE, 
NULL ) == GIF_ERROR )