Skip to content

Commit 8d45c4f

Browse files
committed
Fix GH-16771: imagecreatefromstring overflow on invalid format.
1 parent 02ee521 commit 8d45c4f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/gd/gd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,7 @@ static int _php_ctx_getmbi(gdIOCtx *ctx)
13231323

13241324
do {
13251325
i = (ctx->getC)(ctx);
1326-
if (i < 0) {
1326+
if (i < 0 || mbi > (INT_MAX >> 7)) {
13271327
return -1;
13281328
}
13291329
mbi = (mbi << 7) | (i & 0x7f);

0 commit comments

Comments
 (0)