Source: pngnq
Followup-For: Bug #826797
Control: forwarded -1 https://sourceforge.net/p/pngnq/patches/5/
Control: tag -1 + patch

Hi,

it seems like the issue is due to different data types in newer libpng,
thus using bogus values when trying to allocate memory.
The fix is basically replacing the existing patch libpng16.patch with
what available in the upstream bug #5 [1].

I'm attaching a copy of it here.

[1] https://sourceforge.net/p/pngnq/patches/5/

Thanks,
-- 
Pino
--- pngnq-1.1-old/src/rwpng.c	2010-05-10 18:42:56.000000000 -0400
+++ pngnq-1.1/src/rwpng.c	2012-04-09 10:44:16.384272887 -0400
@@ -32,7 +32,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "png.h"        /* libpng header; includes zlib.h */
 #include "rwpng.h"      /* typedefs, common macros, public prototypes */
 
 /* future versions of libpng will provide this macro: */
--- pngnq-1.1-old/src/rwpng.h	2010-05-10 18:42:56.000000000 -0400
+++ pngnq-1.1/src/rwpng.h	2012-04-09 10:53:53.364767196 -0400
@@ -29,6 +29,15 @@
 
   ---------------------------------------------------------------------------*/
 
+#ifndef PNGNQ_RWPNG_H
+#define PNGNQ_RWPNG_H
+
+#include <png.h>
+
+#if defined(PNG_LIBPNG_VER_MINOR) && PNG_LIBPNG_VER_MINOR >= 5
+#  include <zlib.h>
+#endif
+
 #ifndef TRUE
 #  define TRUE 1
 #  define FALSE 0
@@ -65,9 +74,15 @@
 
 typedef struct _mainprog_info {
     double gamma;
+#if defined(PNG_LIBPNG_VER_MINOR) && PNG_LIBPNG_VER_MINOR >= 5
+    png_uint_32 width;			/* read/write */
+    png_uint_32 height;			/* read/write */
+    png_uint_32 rowbytes;		/* read */
+#else
     ulg width;			/* read/write */
     ulg height;			/* read/write */
     ulg rowbytes;		/* read */
+#endif
     void *png_ptr;		/* read/write */
     void *info_ptr;		/* read/write */
     rwpng_color palette[256];	/* write */
@@ -111,3 +126,6 @@
 int rwpng_write_image_row(mainprog_info *mainprog_ptr);
 
 int rwpng_write_image_finish(mainprog_info *mainprog_ptr);
+
+#endif // PNGNQ_RWPNG_H
+

Reply via email to