Skip to content

Commit

Permalink
gd imageloadfont test while reading header
Browse files Browse the repository at this point in the history
Cover error when the header of an gd font loading is interrupted by end
of file.

Signed-off-by: BlackEagle <ike.devolder@gmail.com>
  • Loading branch information
BlackIkeEagle authored and petk committed Feb 14, 2019
1 parent c2eb68a commit fee9f3a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions ext/gd/tests/imageloadfont_end_of_file_while_reading_header.phpt
@@ -0,0 +1,25 @@
--TEST--
imageloadfont() "End of file while reading header"
--CREDITS--
Ike Devolder <ike.devolder@gmail.com>
User Group: PHP-WVL & PHPGent #PHPTestFest
--SKIPIF--
<?php
if (!extension_loaded('gd')) die("skip gd extension not available\n");
?>
--FILE--
<?php
$filename = dirname(__FILE__) . '/font.gdf';
$bin = "\x41\x41\x41\x41\x00\x00\x00\x00\x00\x00";
$fp = fopen($filename, 'wb');
fwrite($fp, $bin);
fclose($fp);

$font = imageloadfont($filename);
?>
--CLEAN--
<?php
unlink(__DIR__.'/font.gdf');
?>
--EXPECTF--
Warning: imageloadfont(): End of file while reading header in %s on line %d

0 comments on commit fee9f3a

Please sign in to comment.