mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
imageio: add ability restrict max image size
WEBP_MAX_IMAGE_SIZE can be defined to control this limit. Set it to 1.5GiB w/--config=asan-fuzzer to avoid OOM with large resolution images. This limit leaves some headroom over the single image max of 2^14 * 2^14 * 4 BUG=webp:355 Change-Id: I4d48eb0a063638297a842582e0229dfd5a54df5f
This commit is contained in:
parent
6f9daa4a3a
commit
08ea9ecde3
@ -137,7 +137,11 @@ void ImgIoUtilCopyPlane(const uint8_t* src, int src_stride,
|
||||
|
||||
int ImgIoUtilCheckSizeArgumentsOverflow(uint64_t nmemb, size_t size) {
|
||||
const uint64_t total_size = nmemb * size;
|
||||
return (total_size == (size_t)total_size);
|
||||
int ok = (total_size == (size_t)total_size);
|
||||
#if defined(WEBP_MAX_IMAGE_SIZE)
|
||||
ok = ok && (total_size <= (uint64_t)WEBP_MAX_IMAGE_SIZE);
|
||||
#endif
|
||||
return ok;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user