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