xref: /php-src/ext/gd/tests/bug73549.phpt (revision 0b8466f2)
1--TEST--
2Bug #73549 (Use after free when stream is passed to imagepng)
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7if (!(imagetypes() & IMG_PNG)) {
8    die("skip No PNG support");
9}
10?>
11--FILE--
12<?php
13$stream = fopen(__DIR__ . DIRECTORY_SEPARATOR . 'bug73549.png', 'w');
14$im = imagecreatetruecolor(8, 8);
15var_dump(imagepng($im, $stream));
16var_dump($stream);
17?>
18--EXPECTF--
19bool(true)
20resource(%d) of type (stream)
21--CLEAN--
22<?php
23unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug73549.png');
24?>
25