cvs: php4 /ext/gd gd.c
| From: | Rasmus Lerdorf | Date: | Thu, 27 Sep 2001 07:36:34 +0000 |
| Subject: | cvs: php4 /ext/gd gd.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-7590@lists.php.net to get a copy of this message | ||
rasmus Thu Sep 27 03:36:34 2001 EDT
Modified files:
/php4/ext/gd gd.c
Log:
Fix segfault and check for truecolor image in ImageColorAt
@- Fix segfault and check for truecolor image in ImageColorAt (Rasmus)
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.162 php4/ext/gd/gd.c:1.163
--- php4/ext/gd/gd.c:1.162 Tue Sep 25 18:48:33 2001
+++ php4/ext/gd/gd.c Thu Sep 27 03:36:34 2001
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd.c,v 1.162 2001/09/25 22:48:33 jeroen Exp $ */
+/* $Id: gd.c,v 1.163 2001/09/27 07:36:34 rasmus Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -1577,10 +1577,17 @@
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+#if HAVE_LIBGD20
+ if(im->truecolor) {
+ php_error(E_WARNING, "ImageColorAt does not work on TrueColor images");
+ RETURN_FALSE;
+ }
+#endif
+
convert_to_long_ex(x);
convert_to_long_ex(y);
- if (gdImageBoundsSafe(im, Z_LVAL_PP(x), Z_LVAL_PP(y))) {
+ if (im->pixels && gdImageBoundsSafe(im, Z_LVAL_PP(x), Z_LVAL_PP(y))) {
#if HAVE_LIBGD13
RETURN_LONG(im->pixels[Z_LVAL_PP(y)][Z_LVAL_PP(x)]);
#else