1--TEST--
2imageloadfont() function crashes
3--SKIPIF--
4<?php
5	if (!extension_loaded('gd')) die("skip gd extension not available\n");
6?>
7--FILE--
8<?php
9$filename = dirname(__FILE__) .  '/font.gdf';
10$bin = "\x41\x41\x41\x41\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00";
11$fp = fopen($filename, 'wb');
12fwrite($fp, $bin);
13fclose($fp);
14
15$image = imagecreatetruecolor(50, 20);
16$font = imageloadfont($filename);
17$black = imagecolorallocate($image, 0, 0, 0);
18imagestring($image, $font, 0, 0, "Hello", $black);
19unlink($filename);
20?>
21--EXPECTF--
22Warning: imageloadfont(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
23 in %simageloadfont_invalid.php on line %d
24
25Warning: imageloadfont(): Error reading font, invalid font header in %simageloadfont_invalid.php on line %d
26