Annotation of embedaddon/php/ext/gd/tests/imageloadfont_invalid.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: imageloadfont() 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');
13: fwrite($fp, $bin);
14: fclose($fp);
15:
16: $image = imagecreatetruecolor(50, 20);
17: $font = imageloadfont($filename);
18: $black = imagecolorallocate($image, 0, 0, 0);
19: imagestring($image, $font, 0, 0, "Hello", $black);
20: unlink($filename);
21: ?>
22: --EXPECTF--
23: Warning: imageloadfont(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
24: in %simageloadfont_invalid.php on line %d
25:
26: Warning: imageloadfont(): Error reading font, invalid font header in %simageloadfont_invalid.php on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>