mirror of
https://github.com/php/php-src.git
synced 2025-01-11 05:24:49 +08:00
- libgd #86: Fixed possible infinite loop in libgd/gd_png.c
(Reported by Xavier Roche)
This commit is contained in:
parent
b83260a150
commit
69dca143c9
@ -71,7 +71,11 @@ static void gdPngErrorHandler (png_structp png_ptr, png_const_charp msg)
|
||||
|
||||
static void gdPngReadData (png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
gdGetBuf(data, length, (gdIOCtx *) png_get_io_ptr(png_ptr));
|
||||
int check;
|
||||
check = gdGetBuf(data, length, (gdIOCtx *) png_get_io_ptr(png_ptr));
|
||||
if (check != length) {
|
||||
png_error(png_ptr, "Read Error: truncated data");
|
||||
}
|
||||
}
|
||||
|
||||
static void gdPngWriteData (png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
|
21
ext/gd/tests/libgd00086.phpt
Normal file
21
ext/gd/tests/libgd00086.phpt
Normal file
@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #39780 (PNG image with CRC/data error raises a fatal error)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available\n");
|
||||
if (!GD_BUNDLED) die('skip external GD libraries always fail');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$im = imagecreatefrompng(dirname(__FILE__) . '/libgd00086.png');
|
||||
var_dump($im);
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Warning: imagecreatefrompng(): gd-png: fatal libpng error: Read Error: truncated data in %s on line %d
|
||||
|
||||
Warning: imagecreatefrompng(): gd-png error: setjmp returns error condition in %s on line %d
|
||||
|
||||
Warning: imagecreatefrompng(): '%s' is not a valid PNG file in %s on line %d
|
||||
bool(false)
|
BIN
ext/gd/tests/libgd00086.png
Normal file
BIN
ext/gd/tests/libgd00086.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 93 B |
Loading…
Reference in New Issue
Block a user