-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #77479: imagewbmp() segfaults with very large images
We must not proceed working with the Wbmp structure, if it hasn't been allocated.
- Loading branch information
Showing
3 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
?> |