Skip to content

Commit e22ba55

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

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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)