Skip to content

Commit ec05cd5

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents b8115d6 + 6f1d836 commit ec05cd5

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ PHP NEWS
1111
- Curl:
1212
. Fixed bug GH-16723 (CURLMOPT_PUSHFUNCTION issues). (cmb)
1313

14+
- GD:
15+
. Fixed GH-16776 (imagecreatefromstring overflow). (David Carlier)
16+
1417
- Hash:
1518
. Fixed GH-16711: Segfault in mhash(). (Girgias)
1619

ext/gd/gd.c

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

13671367
do {
13681368
i = (ctx->getC)(ctx);
1369-
if (i < 0) {
1369+
if (i < 0 || mbi > (INT_MAX >> 7)) {
13701370
return -1;
13711371
}
13721372
mbi = (mbi << 7) | (i & 0x7f);

ext/gd/tests/gh16771.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)