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