xref: /PHP-8.0/ext/gd/tests/bug73549.phpt (revision a555cc0b)
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--EXPECTF--
15bool(true)
16resource(%d) of type (stream)
17--CLEAN--
18<?php
19unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug73549.png');
20?>
21