Skip to content

Commit 89f7cbd

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix GH-22121: double-free in gdImageSetStyle() after overflow early return
2 parents ba9dfa7 + 6b68d94 commit 89f7cbd

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.5.8
44

5+
- GD:
6+
. Fixed bug GH-22121 (Double free in gdImageSetStyle() after
7+
overflow-triggered early return). (iliaal)
8+
59
- Zlib:
610
. Fixed memory leak if deflate initialization fails and there is a dict.
711
(ndossche)

ext/gd/libgd/gd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2879,12 +2879,12 @@ void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c)
28792879

28802880
void gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels)
28812881
{
2882-
if (im->style) {
2883-
gdFree(im->style);
2884-
}
28852882
if (overflow2(sizeof (int), noOfPixels)) {
28862883
return;
28872884
}
2885+
if (im->style) {
2886+
gdFree(im->style);
2887+
}
28882888
im->style = (int *) gdMalloc(sizeof(int) * noOfPixels);
28892889
memcpy(im->style, style, sizeof(int) * noOfPixels);
28902890
im->styleLength = noOfPixels;

0 commit comments

Comments
 (0)