xref: /PHP-8.3/ext/gd/tests/bug75111.phpt (revision a375d547)
1--TEST--
2Bug #75111 (Memory disclosure or DoS via crafted .bmp image)
3--EXTENSIONS--
4gd
5--FILE--
6<?php
7// craft BMP image
8$str  = hex2bin("424D3603000000000000");
9$str .= pack("V", -0x120000);   // offset of image data
10$str .= pack("V", 40);          // length of header
11$str .= pack("V", 256);         // width
12$str .= pack("V", 256);         // height
13$str .= hex2bin("01001800000000000000000000000000000000000000000000000000");
14
15var_dump(imagecreatefromstring($str));
16?>
17--EXPECTF--
18Warning: imagecreatefromstring(): Passed data is not in "BMP" format in %s on line %d
19
20Warning: imagecreatefromstring(): Couldn't create GD Image Stream out of Data in %s on line %d
21bool(false)
22