mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel] Revised png_measure_compressed_chunk()
too break from "while" and issue a png_warning on over limit.
This commit is contained in:
12
pngrutil.c
12
pngrutil.c
@@ -224,11 +224,8 @@ png_measure_decompressed_chunk(png_structp png_ptr, int comp_type,
|
|||||||
{
|
{
|
||||||
ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
|
ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
|
||||||
if (ret != Z_OK && ret != Z_STREAM_END)
|
if (ret != Z_OK && ret != Z_STREAM_END)
|
||||||
{
|
|
||||||
inflateReset(&png_ptr->zstream);
|
|
||||||
png_ptr->zstream.avail_in = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
if (!png_ptr->zstream.avail_out || ret == Z_STREAM_END)
|
if (!png_ptr->zstream.avail_out || ret == Z_STREAM_END)
|
||||||
{
|
{
|
||||||
if (text == NULL) /* Initialize the decompression buffer */
|
if (text == NULL) /* Initialize the decompression buffer */
|
||||||
@@ -249,9 +246,10 @@ png_measure_decompressed_chunk(png_structp png_ptr, int comp_type,
|
|||||||
text_size >= PNG_USER_CHUNK_MALLOC_MAX - 1)
|
text_size >= PNG_USER_CHUNK_MALLOC_MAX - 1)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
inflateReset(&png_ptr->zstream);
|
png_warning(png_ptr,
|
||||||
png_ptr->zstream.avail_in = 0;
|
"Exceeded malloc limit while expanding chunk");
|
||||||
return 0;
|
text_size = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user