We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 53e5c09 + ec05cd5 commit b948332Copy full SHA for b948332
ext/gd/gd.c
@@ -1366,7 +1366,7 @@ static int _php_ctx_getmbi(gdIOCtx *ctx)
1366
1367
do {
1368
i = (ctx->getC)(ctx);
1369
- if (i < 0) {
+ if (i < 0 || mbi > (INT_MAX >> 7)) {
1370
return -1;
1371
}
1372
mbi = (mbi << 7) | (i & 0x7f);
ext/gd/tests/gh16771.phpt
@@ -0,0 +1,10 @@
1
+--TEST--
2
+GH-16771 (UBSan abort in ext/gd/libgd/gd.c:1372)
3
+--EXTENSIONS--
4
+gd
5
+--FILE--
6
+<?php
7
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OIMzTvvJXvvJbml6XmnKzoqp7jg4bjgq3jgrnjg4g=');
8
+imagecreatefromstring($string_mb);
9
+--EXPECTF--
10
+Warning: imagecreatefromstring(): Data is not in a recognized format in %s on line %d
0 commit comments