diff options
| author | Pierre Joye <pierre.php@gmail.com> | 2016-07-19 13:37:23 +0700 |
|---|---|---|
| committer | Anatol Belski <ab@php.net> | 2016-07-19 15:55:20 +0200 |
| commit | 5b48472ec3446035decc0f86999bba038f14b51d (patch) | |
| tree | c396f8e30c584d45d9a7d33c557fb26713d3e3da /ext/gd/libgd/gd_interpolation.c | |
| parent | 62da85d35db8c655e757e87828dc4eb708139f73 (diff) | |
| download | php-git-5b48472ec3446035decc0f86999bba038f14b51d.tar.gz | |
fix #72512, invalid read or write for palette image when invalid transparent index is used
(cherry picked from commit 0fbcff1b35c1005b8d2cdfd33184867912d9d83a)
Diffstat (limited to 'ext/gd/libgd/gd_interpolation.c')
| -rw-r--r-- | ext/gd/libgd/gd_interpolation.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c index 83319966f9..fb34982582 100644 --- a/ext/gd/libgd/gd_interpolation.c +++ b/ext/gd/libgd/gd_interpolation.c @@ -1244,7 +1244,13 @@ static gdImagePtr gdImageScaleBilinearPalette(gdImagePtr im, const unsigned int if (new_img == NULL) { return NULL; } - new_img->transparent = gdTrueColorAlpha(im->red[transparent], im->green[transparent], im->blue[transparent], im->alpha[transparent]); + + if (transparent < 0) { + /* uninitialized */ + new_img->transparent = -1; + } else { + new_img->transparent = gdTrueColorAlpha(im->red[transparent], im->green[transparent], im->blue[transparent], im->alpha[transparent]); + } for (i=0; i < _height; i++) { long j; |
