mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
pngdec: check version before using png_get_chunk_malloc_max
png_get_chunk_malloc_max / png_set_chunk_malloc_max were added in 1.4.1.
Bug: webp:505, webp:497
Change-Id: Id4e0643a7734563fec7779f7943ec760da8d276d
(cherry picked from commit 2690782292
)
This commit is contained in:
parent
fedac6cc69
commit
113968ca47
@ -259,11 +259,14 @@ int ReadPNG(const uint8_t* const data, size_t data_size,
|
|||||||
goto End;
|
goto End;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LOCAL_PNG_PREREQ(1,5) || \
|
||||||
|
(LOCAL_PNG_PREREQ(1,4) && PNG_LIBPNG_VER_RELEASE >= 1)
|
||||||
// If it looks like the bitstream is going to need more memory than libpng's
|
// If it looks like the bitstream is going to need more memory than libpng's
|
||||||
// internal limit (default: 8M), try to (reasonably) raise it.
|
// internal limit (default: 8M), try to (reasonably) raise it.
|
||||||
if (data_size > png_get_chunk_malloc_max(png) && data_size < (1u << 24)) {
|
if (data_size > png_get_chunk_malloc_max(png) && data_size < (1u << 24)) {
|
||||||
png_set_chunk_malloc_max(png, data_size);
|
png_set_chunk_malloc_max(png, data_size);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
info = png_create_info_struct(png);
|
info = png_create_info_struct(png);
|
||||||
if (info == NULL) goto Error;
|
if (info == NULL) goto Error;
|
||||||
|
Loading…
Reference in New Issue
Block a user