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