cvs: gd /libgd/src gd_png.c /libgd/tests/png CMakeLists.txt Makefile.am bug00193.c
[email protected] ("Takeshi Abe") Fri, 13 Mar 2009 20:18:24 -0000
| Newsgroups | php.gd.cvs |
|---|---|
| Message-ID | <cvstabe1236975504@cvsserver> |
tabe Fri Mar 13 20:18:24 2009 UTC
Added files:
/gd/libgd/tests/png bug00193.c
Modified files:
/gd/libgd/src gd_png.c
/gd/libgd/tests/png CMakeLists.txt Makefile.am
Log:
fixed FS#193
http://cvs.php.net/viewvc.cgi/gd/libgd/src/gd_png.c?r1=1.28&r2=1.29&diff_format=u
Index: gd/libgd/src/gd_png.c
diff -u gd/libgd/src/gd_png.c:1.28 gd/libgd/src/gd_png.c:1.29
--- gd/libgd/src/gd_png.c:1.28 Fri Mar 13 15:50:38 2009
+++ gd/libgd/src/gd_png.c Fri Mar 13 20:18:24 2009
@@ -1,4 +1,4 @@
-/* $Id: gd_png.c,v 1.28 2009/03/13 15:50:38 tabe Exp $ */
+/* $Id: gd_png.c,v 1.29 2009/03/13 20:18:24 tabe Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -606,6 +606,10 @@
++colors;
}
}
+ if (colors == 0) {
+ fprintf(stderr, "gd-png error: no colors in palette\n");
+ goto bail;
+ }
if (colors < im->colorsTotal)
{
remap = TRUE;
@@ -855,6 +859,7 @@
}
}
/* 1.6.3: maybe we should give that memory BACK! TBB */
+ bail:
png_destroy_write_struct (&png_ptr, &info_ptr);
}
http://cvs.php.net/viewvc.cgi/gd/libgd/tests/png/CMakeLists.txt?r1=1.7&r2=1.8&diff_format=u
Index: gd/libgd/tests/png/CMakeLists.txt
diff -u gd/libgd/tests/png/CMakeLists.txt:1.7 gd/libgd/tests/png/CMakeLists.txt:1.8
--- gd/libgd/tests/png/CMakeLists.txt:1.7 Sun Mar 8 09:16:04 2009
+++ gd/libgd/tests/png/CMakeLists.txt Fri Mar 13 20:18:24 2009
@@ -5,6 +5,7 @@
bug00033
bug00086
bug00088
+ bug00193
)
FOREACH(test_name ${TESTS_FILES})
http://cvs.php.net/viewvc.cgi/gd/libgd/tests/png/Makefile.am?r1=1.2&r2=1.3&diff_format=u
Index: gd/libgd/tests/png/Makefile.am
diff -u gd/libgd/tests/png/Makefile.am:1.2 gd/libgd/tests/png/Makefile.am:1.3
--- gd/libgd/tests/png/Makefile.am:1.2 Sun Mar 8 09:16:04 2009
+++ gd/libgd/tests/png/Makefile.am Fri Mar 13 20:18:24 2009
@@ -1,3 +1,3 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
-EXTRA_DIST = CMakeLists.txt bug00011.c bug00033.png bug00088_1_exp.png bug00088_2_exp.png bug00088.c bug00033.c bug00086.c bug00088_1.png bug00088_2.png emptyfile png_resolution.c
+EXTRA_DIST = CMakeLists.txt bug00011.c bug00033.png bug00088_1_exp.png bug00088_2_exp.png bug00088.c bug00033.c bug00086.c bug00088_1.png bug00088_2.png bug00193.c emptyfile png_resolution.c
http://cvs.php.net/viewvc.cgi/gd/libgd/tests/png/bug00193.c?view=markup&rev=1.1
Index: gd/libgd/tests/png/bug00193.c
+++ gd/libgd/tests/png/bug00193.c
#include "gd.h"
#include <stdio.h>
#include "gdtest.h"
static gdImagePtr im;
#define TERMINATE(ctx, status) do { \
gdFree(ctx); \
gdImageDestroy(im); \
exit(status); \
} while (0)
static void
failPutC(gdIOCtxPtr ctx, int c)
{
TERMINATE(ctx, 1);
}
static int
failPutBuf(gdIOCtxPtr ctx, const void * data, int size)
{
TERMINATE(ctx, 1);
return -1;
}
int main()
{
gdIOCtxPtr ctx;
im = gdImageCreate(100, 100);
ctx = (gdIOCtxPtr)gdMalloc(sizeof(gdIOCtx));
ctx->putC = failPutC;
ctx->putBuf = failPutBuf;
gdImagePngCtx(im, ctx);
TERMINATE(ctx, 0);
return 0;
}