pajoye Wed Dec 18 16:13:21 2002 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Fix a crash while using an invalid color with imagesetstyle, see the sample script in the manual to reproduce it :) Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.38 php4/ext/gd/libgd/gd.c:1.39 --- php4/ext/gd/libgd/gd.c:1.38 Sun Dec 15 13:16:11 2002 +++ php4/ext/gd/libgd/gd.c Wed Dec 18 16:13:21 2002 @@ -589,21 +589,19 @@ im->open[color] = 1; } -void -gdImageColorTransparent (gdImagePtr im, int color) +void gdImageColorTransparent (gdImagePtr im, int color) { - if (!im->trueColor) - { - if (im->transparent != -1) - { - im->alpha[im->transparent] = gdAlphaOpaque; + if (!im->trueColor) { + if (im->transparent != -1) { + im->alpha[im->transparent] = gdAlphaOpaque; + } + if (color > -1 && color<=gdMaxColors) { + im->alpha[color] = gdAlphaTransparent; + } else { + return; + } } - if (color != -1) - { - im->alpha[color] = gdAlphaTransparent; - } - } - im->transparent = color; + im->transparent = color; } void
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php