xref: /PHP-7.3/ext/gd/tests/bug73549.phpt (revision 5049ef2f)
1--TEST--
2Bug #73549 (Use after free when stream is passed to imagepng)
3--SKIPIF--
4<?php
5if (!extension_loaded('gd')) die('skip gd extension not available');
6?>
7--FILE--
8<?php
9$stream = fopen(__DIR__ . DIRECTORY_SEPARATOR . 'bug73549.png', 'w');
10$im = imagecreatetruecolor(8, 8);
11var_dump(imagepng($im, $stream));
12var_dump($stream);
13?>
14===DONE===
15--EXPECTF--
16bool(true)
17resource(%d) of type (stream)
18===DONE===
19--CLEAN--
20<?php
21unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug73549.png');
22?>
23