[PHP-DEV] [PATCH] imageinterlace (ext/gd) with one argument crashes From: Flavien Lebarbé (flavien <email protected>)
Date: 09/18/00

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);

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>