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