imageloadfont_invalid.phpt 726 B

1234567891011121314151617181920212223
  1. --TEST--
  2. imageloadfont() function crashes
  3. --EXTENSIONS--
  4. gd
  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');
  10. fwrite($fp, $bin);
  11. fclose($fp);
  12. $image = imagecreatetruecolor(50, 20);
  13. $font = imageloadfont($filename);
  14. $black = imagecolorallocate($image, 0, 0, 0);
  15. imagestring($image, $font, 0, 0, "Hello", $black);
  16. unlink($filename);
  17. ?>
  18. --EXPECTF--
  19. Warning: imageloadfont(): Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
  20. in %simageloadfont_invalid.php on line %d
  21. Warning: imageloadfont(): Error reading font, invalid font header in %simageloadfont_invalid.php on line %d