Skip to content

Commit 70bbe8f

Browse files
committed
add test
1 parent 8f50b10 commit 70bbe8f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

ext/gd/tests/gh17772.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
GH-17772 (imagepalettetotruecolor segfault on image deallocation)
3+
--EXTENSIONS--
4+
gd
5+
--INI--
6+
memory_limit=2M
7+
--CREDITS--
8+
YuanchengJiang
9+
--FILE--
10+
<?php
11+
function setStyleAndThickness($im, $color, $thickness)
12+
{
13+
$arr = [];
14+
$i = 0;
15+
while ($i < 16 * $thickness) {
16+
$arer[$i++] = $color;
17+
}
18+
}
19+
$im = imagecreate(800, 800);
20+
setStyleAndThickness($im, 0, 6);
21+
imagepalettetotruecolor($im);
22+
?>
23+
--EXPECTF--
24+
Fatal error: Allowed memory size of 2097152 bytes exhausted at %s:%d (tried to allocate %d bytes) in %s on line %d

0 commit comments

Comments
 (0)