mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
Merge branch 'PHP-7.3'
* PHP-7.3: Fix #77479: imagewbmp() segfaults with very large images
This commit is contained in:
commit
387c45a9bb
2 changed files with 27 additions and 0 deletions
|
@ -100,6 +100,7 @@ void gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out)
|
||||||
/* create the WBMP */
|
/* create the WBMP */
|
||||||
if ((wbmp = createwbmp (gdImageSX (image), gdImageSY (image), WBMP_WHITE)) == NULL) {
|
if ((wbmp = createwbmp (gdImageSX (image), gdImageSY (image), WBMP_WHITE)) == NULL) {
|
||||||
gd_error("Could not create WBMP");
|
gd_error("Could not create WBMP");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fill up the WBMP structure */
|
/* fill up the WBMP structure */
|
||||||
|
|
26
ext/gd/tests/bug77479.phpt
Normal file
26
ext/gd/tests/bug77479.phpt
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #77479 (imagewbmp() segfaults with very large image)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||||
|
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||||
|
?>
|
||||||
|
--INI--
|
||||||
|
memory_limit=-1
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$im = imagecreate(40000, 20000);
|
||||||
|
imagecolorallocate($im, 0, 0, 0);
|
||||||
|
imagewbmp($im, __DIR__ . '/77479.wbmp');
|
||||||
|
?>
|
||||||
|
===DONE===
|
||||||
|
--EXPECTF--
|
||||||
|
Warning: imagewbmp(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
|
||||||
|
in %s on line %d
|
||||||
|
|
||||||
|
Warning: imagewbmp(): Could not create WBMP in %s on line %d
|
||||||
|
===DONE===
|
||||||
|
--CLEAN--
|
||||||
|
<?php
|
||||||
|
@unlink(__DIR__ . '/77479.wbmp');
|
||||||
|
?>
|
Loading…
Add table
Add a link
Reference in a new issue