diff options
| author | Rasmus Lerdorf <rasmus@php.net> | 2001-09-27 07:36:34 +0000 |
|---|---|---|
| committer | Rasmus Lerdorf <rasmus@php.net> | 2001-09-27 07:36:34 +0000 |
| commit | c8280238dee921d38495791ba8fc5a2c982c996b (patch) | |
| tree | a59484684ee5260f164e0f83285dcf120cfe9f6e | |
| parent | be52d66f4ba044a2c61f42e4ad04cc98f5571ec9 (diff) | |
| download | php-git-c8280238dee921d38495791ba8fc5a2c982c996b.tar.gz | |
Fix segfault and check for truecolor image in ImageColorAt
@- Fix segfault and check for truecolor image in ImageColorAt (Rasmus)
| -rw-r--r-- | ext/gd/gd.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/gd/gd.c b/ext/gd/gd.c index c40b30db14..7b2c03672e 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1577,10 +1577,17 @@ PHP_FUNCTION(imagecolorat) 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 |
