xref: /PHP-8.1/ext/gd/tests/bug66339.phpt (revision a375d547)
1--TEST--
2Bug #66339 (PHP segfaults in imagexbm)
3--EXTENSIONS--
4gd
5--FILE--
6<?php
7$im = imagecreate(8, 8);
8imagecolorallocate($im, 0, 0, 0); // background
9$white = imagecolorallocate($im, 255, 255, 255);
10imagefilledrectangle($im, 2, 2, 6, 6, $white);
11imagexbm($im, NULL);
12echo "------------\n";
13imagexbm($im, './bug66339.xbm');
14echo file_get_contents('./bug66339.xbm');
15?>
16--CLEAN--
17<?php
18unlink('./bug66339.xbm');
19?>
20--EXPECT--
21#define image_width 8
22#define image_height 8
23static unsigned char image_bits[] = {
24  0xFF, 0xFF, 0x83, 0x83, 0x83, 0x83, 0x83, 0xFF};
25------------
26#define bug66339_width 8
27#define bug66339_height 8
28static unsigned char bug66339_bits[] = {
29  0xFF, 0xFF, 0x83, 0x83, 0x83, 0x83, 0x83, 0xFF};
30