Merge branch 'PHP-8.4'

This commit is contained in:
David Carlier 2024-10-05 11:35:57 +01:00
commit 9709887815
No known key found for this signature in database
GPG key ID: 8486F847B4B94EF1
2 changed files with 29 additions and 1 deletions

View file

@ -37,7 +37,8 @@
int int
getmbi (int (*getin) (void *in), void *in) getmbi (int (*getin) (void *in), void *in)
{ {
int i, mbi = 0; unsigned int mbi = 0;
int i;
do do
{ {

27
ext/gd/tests/gh16232.phpt Normal file
View file

@ -0,0 +1,27 @@
--TEST--
GH-16232 (Overflow on reading wbmp content)
--EXTENSIONS--
gd
--FILE--
<?php
$good_webp = __DIR__ . '/src.wbmp';
$bad_webp = __DIR__ . "/gh16232.webp";
copy($good_webp, $bad_webp);
var_dump(imagecreatefromwbmp($bad_webp));
$data = file_get_contents($bad_webp);
$data[3] = chr(-1);
file_put_contents($bad_webp, $data);
var_dump(imagecreatefromwbmp($bad_webp));
$data[3] = chr(1000);
file_put_contents($bad_webp, $data);
var_dump(imagecreatefromwbmp($bad_webp));
unlink($bad_webp);
--EXPECTF--
object(GdImage)#1 (0) {
}
Warning: imagecreatefromwbmp(): "%s" is not a valid WBMP file in %s on line %d
bool(false)
Warning: imagecreatefromwbmp(): "%s" is not a valid WBMP file in %s on line %d
bool(false)