diff options
author | Pierre Joye <pajoye@php.net> | 2016-07-04 10:35:20 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2016-07-04 10:35:20 +0200 |
commit | 7b2c22696ad44df1d26d70e15521adebd95c0399 (patch) | |
tree | 1ef08ac43e9da489d4c7bfa5e1f360ad9600a60b | |
parent | cab1c3b3708eead315e033359d07049b23b147a3 (diff) | |
download | php-git-7b2c22696ad44df1d26d70e15521adebd95c0399.tar.gz |
Fixed bug #72512 gdImageTrueColorToPaletteBody allows arbitrary write/read access
-rw-r--r-- | ext/gd/libgd/gd.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index 4dad95ae39..3a9577859e 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -599,15 +599,18 @@ void gdImageColorDeallocate (gdImagePtr im, int color) void gdImageColorTransparent (gdImagePtr im, int color) { + if (color < 0) { + return; + } + if (!im->trueColor) { + if((color >= gdMaxColors)) { + return; + } if (im->transparent != -1) { im->alpha[im->transparent] = gdAlphaOpaque; } - if (color > -1 && color < im->colorsTotal && color < gdMaxColors) { - im->alpha[color] = gdAlphaTransparent; - } else { - return; - } + im->alpha[color] = gdAlphaTransparent; } im->transparent = color; } |