Protect against oversized (out of bounds) samples in avif sample tables Fixes oss-fuzz @ 21947
diff --git a/src/read.c b/src/read.c index 735d841..f258846 100644 --- a/src/read.c +++ b/src/read.c
@@ -344,6 +344,9 @@ if (sampleOffset > (uint64_t)rawInput->size) { return AVIF_FALSE; } + if ((sampleOffset + sampleSize) > (uint64_t)rawInput->size) { + return AVIF_FALSE; + } sampleOffset += sampleSize; ++sampleSizeIndex;