Skip to content

Commit

Permalink
iFixed bug #72446 - Integer Overflow in gdImagePaletteToTrueColor() r…
Browse files Browse the repository at this point in the history
…esulting in heap overflow
  • Loading branch information
smalyshev committed Jun 21, 2016
1 parent b028cac commit c395c6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ PHP NEWS
. Fixed bug #72339 (Integer Overflow in _gd2GetHeader() resulting in
heap overflow). (Pierre)
. Fixed bug #72407 (NULL Pointer Dereference at _gdScaleVert). (Stas)
. Fixed bug #72446 (Integer Overflow in gdImagePaletteToTrueColor() resulting
in heap overflow). (Pierre)

- mbstring:
. Fixed bug #72402 (_php_mb_regex_ereg_replace_exec - double free). (Stas)
Expand Down
4 changes: 4 additions & 0 deletions ext/gd/libgd/gd.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ gdImagePtr gdImageCreate (int sx, int sy)
return NULL;
}

if (overflow2(sizeof(unsigned char *), sx)) {
return NULL;
}

im = (gdImage *) gdCalloc(1, sizeof(gdImage));

/* Row-major ever since gd 1.3 */
Expand Down

0 comments on commit c395c6e

Please sign in to comment.