xref: /PHP-7.3/ext/gd/tests/bug66339-mb.phpt (revision 530f9666)
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--EXPECTF--
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%swidth 8
29#define bug66339%sheight 8
30static unsigned char bug66339%sbits[] = {
31  0xFF, 0xFF, 0x83, 0x83, 0x83, 0x83, 0x83, 0xFF};
32