xref: /PHP-7.3/ext/gd/tests/bug77973.phpt (revision ed6dee9a)
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===DONE===
17--EXPECTF--
18Warning: imagecreatefromxbm(): invalid XBM in %s on line %d
19
20Warning: imagecreatefromxbm(): '%s' is not a valid XBM file in %s on line %d
21bool(false)
22===DONE===
23--CLEAN--
24<?php
25unlink(__DIR__ . '/bug77973.xbm');
26?>
27