diff options
author | Pierre Joye <pajoye@php.net> | 2002-12-18 21:13:21 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2002-12-18 21:13:21 +0000 |
commit | baea3414a39b5b79379d8cfc8d8de1cecb9eed3d (patch) | |
tree | 7408a1a4f79529692dbc94dc4c6fc353de9afdb7 | |
parent | 978340cfa59e926109b842886a4dc53ee2f33273 (diff) | |
download | php-git-baea3414a39b5b79379d8cfc8d8de1cecb9eed3d.tar.gz |
Fix a crash while using an invalid color with imagesetstyle, see the sample
script in the manual to reproduce it :)
-rw-r--r-- | ext/gd/libgd/gd.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index 8c6f35d756..f70a1e985b 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -589,21 +589,19 @@ gdImageColorDeallocate (gdImagePtr im, int color) 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 (color != -1) - { - im->alpha[color] = gdAlphaTransparent; + if (!im->trueColor) { + if (im->transparent != -1) { + im->alpha[im->transparent] = gdAlphaOpaque; + } + if (color > -1 && color<=gdMaxColors) { + im->alpha[color] = gdAlphaTransparent; + } else { + return; + } } - } - im->transparent = color; + im->transparent = color; } void |