mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng17] Use a more generous size limit for IDAT chunks.
This commit is contained in:
parent
3e2769b9d7
commit
69ddffdf2c
8
ANNOUNCE
8
ANNOUNCE
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Libpng 1.7.0beta90 - August 28, 2017
|
Libpng 1.7.0beta90 - September 3, 2017
|
||||||
|
|
||||||
This is not intended to be a public release. It will be replaced
|
This is not intended to be a public release. It will be replaced
|
||||||
within a few weeks by a public version or by another test version.
|
within a few weeks by a public version or by another test version.
|
||||||
@ -1433,15 +1433,17 @@ Version 1.7.0beta87 [April 1, 2017]
|
|||||||
|
|
||||||
Version 1.7.0beta88 [August 7. 2017]
|
Version 1.7.0beta88 [August 7. 2017]
|
||||||
Added private png_check_chunk_name() and png_check_chunk_length()
|
Added private png_check_chunk_name() and png_check_chunk_length()
|
||||||
functions.
|
functions (Fixes CVE-2017-12652).
|
||||||
|
|
||||||
Version 1.7.0beta89 [August 19, 2017]
|
Version 1.7.0beta89 [August 19, 2017]
|
||||||
Check for 0 return from png_get_rowbytes() in contrib/pngminus/*.c to stop
|
Check for 0 return from png_get_rowbytes() in contrib/pngminus/*.c to stop
|
||||||
some Coverity issues (162705, 162706, and 162707).
|
some Coverity issues (162705, 162706, and 162707).
|
||||||
|
|
||||||
Version 1.7.0beta90 [August 28, 2017]
|
Version 1.7.0beta90 [September 3, 2017]
|
||||||
Added PNGMINUS_UNUSED macro to contrib/pngminus/p*.c and added missing
|
Added PNGMINUS_UNUSED macro to contrib/pngminus/p*.c and added missing
|
||||||
parenthesis in contrib/pngminus/pnm2png.c (bug report by Christian Hesse).
|
parenthesis in contrib/pngminus/pnm2png.c (bug report by Christian Hesse).
|
||||||
|
Compute a larger limit on IDAT because some applications write a deflate
|
||||||
|
buffer for each row (Bug report by Andrew Church).
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
6
CHANGES
6
CHANGES
@ -5734,15 +5734,17 @@ Version 1.7.0beta87 [April 1, 2017]
|
|||||||
Version 1.7.0beta88 [August 7, 2017]
|
Version 1.7.0beta88 [August 7, 2017]
|
||||||
Initialized btoa[] in pngstest.c
|
Initialized btoa[] in pngstest.c
|
||||||
Added private png_check_chunk_name() and png_check_chunk_length()
|
Added private png_check_chunk_name() and png_check_chunk_length()
|
||||||
functions.
|
functions (Fixes CVE-2017-12652).
|
||||||
|
|
||||||
Version 1.7.0beta89 [August 19, 2017]
|
Version 1.7.0beta89 [August 19, 2017]
|
||||||
Check for 0 return from png_get_rowbytes() in contrib/pngminus/*.c to stop
|
Check for 0 return from png_get_rowbytes() in contrib/pngminus/*.c to stop
|
||||||
some Coverity issues (162705, 162706, and 162707).
|
some Coverity issues (162705, 162706, and 162707).
|
||||||
|
|
||||||
Version 1.7.0beta90 [August 28, 2017]
|
Version 1.7.0beta90 [September 3, 2017]
|
||||||
Added PNGMINUS_UNUSED macro to contrib/pngminus/p*.c and added missing
|
Added PNGMINUS_UNUSED macro to contrib/pngminus/p*.c and added missing
|
||||||
parenthesis in contrib/pngminus/pnm2png.c (bug report by Christian Hesse).
|
parenthesis in contrib/pngminus/pnm2png.c (bug report by Christian Hesse).
|
||||||
|
Compute a larger limit on IDAT because some applications write a deflate
|
||||||
|
buffer for each row (Bug report by Andrew Church).
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
26
pngrutil.c
26
pngrutil.c
@ -2649,31 +2649,31 @@ png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length)
|
|||||||
{
|
{
|
||||||
png_alloc_size_t limit = PNG_UINT_31_MAX;
|
png_alloc_size_t limit = PNG_UINT_31_MAX;
|
||||||
|
|
||||||
if (png_ptr->chunk_name != png_IDAT)
|
|
||||||
{
|
|
||||||
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
if (png_ptr->user_chunk_malloc_max > 0 &&
|
if (png_ptr->user_chunk_malloc_max > 0 &&
|
||||||
png_ptr->user_chunk_malloc_max < limit)
|
png_ptr->user_chunk_malloc_max < limit)
|
||||||
limit = png_ptr->user_chunk_malloc_max;
|
limit = png_ptr->user_chunk_malloc_max;
|
||||||
# elif PNG_USER_CHUNK_MALLOC_MAX > 0
|
# elif PNG_USER_CHUNK_MALLOC_MAX > 0
|
||||||
if (PNG_USER_CHUNK_MALLOC_MAX < limit)
|
if (PNG_USER_CHUNK_MALLOC_MAX < limit)
|
||||||
limit = PNG_USER_CHUNK_MALLOC_MAX;
|
limit = PNG_USER_CHUNK_MALLOC_MAX;
|
||||||
# endif
|
# endif
|
||||||
}
|
if (png_ptr->chunk_name == png_IDAT)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
/* color_type 0 x 2 3 4 x 6 */
|
/* color_type 0 x 2 3 4 x 6 */
|
||||||
int channels[]={1,0,3,1,2,0,4};
|
int channels[]={1,0,3,1,2,0,4};
|
||||||
|
png_alloc_size_t idat_limit = PNG_UINT_31_MAX;
|
||||||
size_t row_factor =
|
size_t row_factor =
|
||||||
(png_ptr->width * channels[png_ptr->color_type] *
|
(png_ptr->width * channels[png_ptr->color_type] *
|
||||||
(png_ptr->bit_depth > 8? 2: 1)
|
(png_ptr->bit_depth > 8? 2: 1)
|
||||||
+ 1 + (png_ptr->interlaced? 6: 0));
|
+ 1 + (png_ptr->interlaced? 6: 0));
|
||||||
if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
|
if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
|
||||||
limit=PNG_UINT_31_MAX;
|
idat_limit=PNG_UINT_31_MAX;
|
||||||
else
|
else
|
||||||
limit = png_ptr->height * row_factor;
|
idat_limit = png_ptr->height * row_factor;
|
||||||
limit += 6 + 5*(limit/32566+1); /* zlib+deflate overhead */
|
row_factor = row_factor > 32566? 32566 : row_factor;
|
||||||
limit=limit < PNG_UINT_31_MAX? limit : PNG_UINT_31_MAX;
|
idat_limit += 6 + 5*(idat_limit/row_factor+1); /* zlib+deflate overhead */
|
||||||
|
idat_limit=idat_limit < PNG_UINT_31_MAX? idat_limit : PNG_UINT_31_MAX;
|
||||||
|
limit = limit < idat_limit? idat_limit : limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length > limit)
|
if (length > limit)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user