[PATCH] imageinterlace (ext/gd) with one argument crashes
| From: | Flavien Lebarbé | Date: | Mon, 18 Sep 2000 22:39:24 +0000 |
| Subject: | [PATCH] imageinterlace (ext/gd) with one argument crashes | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-33455@lists.php.net to get a copy of this message | ||
Hi,
If called with only one argument, imageinterlace will cause a
segfault. Small reproducing script :
<?php
$i=imagecreate(5,5);
imageinterlace($i);
?>
It's exactly the same problem we had with imagecolortransparent
a few weeks ago that we discussed together, Andi (bug #6130).
Have a look at the enclosed patch I wrote and commit
to cvs if OK.
Thanks go to Martin Storjö for pointing this one out.
Flavien.
--- ext/gd/gd.c.orig Tue Aug 22 11:23:26 2000
+++ ext/gd/gd.c Tue Sep 19 00:01:36 2000
@@ -1427,7 +1427,7 @@
Enable or disable interlace */
PHP_FUNCTION(imageinterlace)
{
- zval **IM, **INT = NULL;
+ zval **IM, **INT;
gdImagePtr im;
int interlace;
GDLS_FETCH();
@@ -1450,7 +1450,7 @@
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image",
GDG(le_gd));
- if ((*INT) != NULL) {
+ if (ZEND_NUM_ARGS() > 1) {
interlace = (*INT)->value.lval;
gdImageInterlace(im,interlace);