xref: /PHP-8.0/ext/gd/tests/bug77973.phpt (revision 4e6fbb0a)
1--TEST--
2Bug #77973 (Uninitialized read in gdImageCreateFromXbm)
3--SKIPIF--
4<?php
5if (!extension_loaded('gd')) die("skip gd extension not available");
6if (!function_exists('imagecreatefromxbm')) die("skip imagecreatefromxbm not available");
7?>
8--FILE--
9<?php
10$contents = hex2bin("23646566696e6520776964746820320a23646566696e652068656967687420320a737461746963206368617220626974735b5d203d7b0a7a7a787a7a");
11$filepath = __DIR__ . '/bug77973.xbm';
12file_put_contents($filepath, $contents);
13$im = imagecreatefromxbm($filepath);
14var_dump($im);
15?>
16--EXPECTF--
17Warning: imagecreatefromxbm(): Invalid XBM in %s on line %d
18
19Warning: imagecreatefromxbm(): "%s" is not a valid XBM file in %s on line %d
20bool(false)
21--CLEAN--
22<?php
23unlink(__DIR__ . '/bug77973.xbm');
24?>
25