Skip to content

Commit 215c61f

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents 71e5d77 + 8ff1795 commit 215c61f

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ PHP NEWS
5151
- JSON:
5252
. Fixed bug GH-15168 (stack overflow in json_encode()). (nielsdos)
5353

54+
- GD:
55+
. Fixed bug 16232 (bitshift overflow on wbmp file content reading /
56+
fix backport from upstream). (David Carlier)
57+
5458
- LDAP:
5559
. Fixed bug GH-16032 (Various NULL pointer dereferencements in
5660
ldap_modify_batch()). (Girgias)

ext/gd/libgd/wbmp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
int
3838
getmbi (int (*getin) (void *in), void *in)
3939
{
40-
int i, mbi = 0;
40+
unsigned int mbi = 0;
41+
int i;
4142

4243
do
4344
{

ext/gd/tests/gh16232.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
GH-16232 (Overflow on reading wbmp content)
3+
--EXTENSIONS--
4+
gd
5+
--FILE--
6+
<?php
7+
$good_webp = __DIR__ . '/src.wbmp';
8+
$bad_webp = __DIR__ . "/gh16232.webp";
9+
copy($good_webp, $bad_webp);
10+
var_dump(imagecreatefromwbmp($bad_webp));
11+
$data = file_get_contents($bad_webp);
12+
$data[3] = chr(-1);
13+
file_put_contents($bad_webp, $data);
14+
var_dump(imagecreatefromwbmp($bad_webp));
15+
$data[3] = chr(1000);
16+
file_put_contents($bad_webp, $data);
17+
var_dump(imagecreatefromwbmp($bad_webp));
18+
unlink($bad_webp);
19+
--EXPECTF--
20+
object(GdImage)#1 (0) {
21+
}
22+
23+
Warning: imagecreatefromwbmp(): "%s" is not a valid WBMP file in %s on line %d
24+
bool(false)
25+
26+
Warning: imagecreatefromwbmp(): "%s" is not a valid WBMP file in %s on line %d
27+
bool(false)

0 commit comments

Comments
 (0)