Skip to content

Commit

Permalink
Fixed bug #72512 gdImageTrueColorToPaletteBody allows arbitrary write…
Browse files Browse the repository at this point in the history
…/read access
  • Loading branch information
pierrejoye authored and weltling committed Jul 4, 2016
1 parent cab1c3b commit 7b2c226
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ext/gd/libgd/gd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7b2c226

Please sign in to comment.