cvs: gd /libgd gd.c /libgd/tests/gdimagecolordeallocate gdimagecolordeallocate.c
[email protected] ("Mattias Bengtsson") Sat, 01 Sep 2007 12:35:18 -0000
| Newsgroups | php.gd.cvs |
|---|---|
| Message-ID | <cvsmattias1188650118@cvsserver> |
mattias Sat Sep 1 12:35:18 2007 UTC
Modified files:
/gd/libgd gd.c
/gd/libgd/tests/gdimagecolordeallocate gdimagecolordeallocate.c
Log:
-MFB #112, More checking
http://cvs.php.net/viewvc.cgi/gd/libgd/gd.c?r1=1.70&r2=1.71&diff_format=u
Index: gd/libgd/gd.c
diff -u gd/libgd/gd.c:1.70 gd/libgd/gd.c:1.71
--- gd/libgd/gd.c:1.70 Fri Aug 31 07:43:58 2007
+++ gd/libgd/gd.c Sat Sep 1 12:35:18 2007
@@ -1,4 +1,4 @@
-/* $Id: gd.c,v 1.70 2007/08/31 07:43:58 mattias Exp $ */
+/* $Id: gd.c,v 1.71 2007/09/01 12:35:18 mattias Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -588,7 +588,7 @@
BGD_DECLARE(void) gdImageColorDeallocate (gdImagePtr im, int color)
{
- if (im->trueColor || (color >= gdMaxColors))
+ if (im->trueColor || (color >= gdMaxColors) || (color < 0))
{
return;
}
http://cvs.php.net/viewvc.cgi/gd/libgd/tests/gdimagecolordeallocate/gdimagecolordeallocate.c?r1=1.2&r2=1.3&diff_format=u
Index: gd/libgd/tests/gdimagecolordeallocate/gdimagecolordeallocate.c
diff -u gd/libgd/tests/gdimagecolordeallocate/gdimagecolordeallocate.c:1.2 gd/libgd/tests/gdimagecolordeallocate/gdimagecolordeallocate.c:1.3
--- gd/libgd/tests/gdimagecolordeallocate/gdimagecolordeallocate.c:1.2 Fri Aug 31 07:43:58 2007
+++ gd/libgd/tests/gdimagecolordeallocate/gdimagecolordeallocate.c Sat Sep 1 12:35:18 2007
@@ -17,6 +17,14 @@
error = -1;
}
+ im->open[-1] = 0;
+
+ gdImageColorDeallocate(im, -1);
+
+ if(im->open[-1] == 1) {
+ error = -1;
+ }
+
gdImageDestroy(im);
return error;