Set max image size to 16384 * 16384 Fix https://crbug.com/oss-fuzz/24728 and https://crbug.com/oss-fuzz/24734.
diff --git a/src/read.c b/src/read.c index e992219..fa1a513 100644 --- a/src/read.c +++ b/src/read.c
@@ -980,6 +980,9 @@ CHECK(avifROStreamReadU32(&s, &grid->outputWidth)); // unsigned int(FieldLength) output_width; CHECK(avifROStreamReadU32(&s, &grid->outputHeight)); // unsigned int(FieldLength) output_height; } + if (grid->outputWidth > AVIF_MAX_IMAGE_SIZE / grid->outputHeight) { + return AVIF_FALSE; + } return AVIF_TRUE; }