Skip to content

Commit fee9f3a

Browse files
BlackIkeEaglepetk
authored andcommitted
gd imageloadfont test while reading header
Cover error when the header of an gd font loading is interrupted by end of file. Signed-off-by: BlackEagle <ike.devolder@gmail.com>
1 parent c2eb68a commit fee9f3a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
imageloadfont() "End of file while reading header"
3+
--CREDITS--
4+
Ike Devolder <ike.devolder@gmail.com>
5+
User Group: PHP-WVL & PHPGent #PHPTestFest
6+
--SKIPIF--
7+
<?php
8+
if (!extension_loaded('gd')) die("skip gd extension not available\n");
9+
?>
10+
--FILE--
11+
<?php
12+
$filename = dirname(__FILE__) . '/font.gdf';
13+
$bin = "\x41\x41\x41\x41\x00\x00\x00\x00\x00\x00";
14+
$fp = fopen($filename, 'wb');
15+
fwrite($fp, $bin);
16+
fclose($fp);
17+
18+
$font = imageloadfont($filename);
19+
?>
20+
--CLEAN--
21+
<?php
22+
unlink(__DIR__.'/font.gdf');
23+
?>
24+
--EXPECTF--
25+
Warning: imageloadfont(): End of file while reading header in %s on line %d

0 commit comments

Comments
 (0)