cvs: php4 /ext/gd/libgd gd.c

From: Date: Wed, 18 Dec 2002 21:13:21 +0000
Subject: cvs: php4 /ext/gd/libgd gd.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-17263@lists.php.net to get a copy of this message
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

« previous php.cvs (#17263) next »