aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2024-03-21 18:26:15 -0700
committerJames Zern <jzern@google.com>2024-03-21 18:32:55 -0700
commit3c0011bbd15fde2f8b30e9affb2411ab23fb468c (patch)
tree45e26dc6be044bd91c606d3ce15672dd93140e65
parent955a3d14aef2d52988315f9f13372b47acefe02d (diff)
downloadwebp-3c0011bbd15fde2f8b30e9affb2411ab23fb468c.tar.gz
WebPMuxGetChunk: add an assert
assert idx != IDX_LAST_CHUNK to quiet a static analysis warning (reported by Coverity): overrun-local: Overrunning array kChunks of 11 12-byte elements at element index 11 (byte offset 143) using index idx (which evaluates to 11). Change-Id: I85ae159e338d5670c007f76277ffe94e7a1dcafc
-rw-r--r--src/mux/muxread.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/mux/muxread.c b/src/mux/muxread.c
index 64df1659..afd3542e 100644
--- a/src/mux/muxread.c
+++ b/src/mux/muxread.c
@@ -432,6 +432,7 @@ WebPMuxError WebPMuxGetChunk(const WebPMux* mux, const char fourcc[4],
return WEBP_MUX_INVALID_ARGUMENT;
}
idx = ChunkGetIndexFromFourCC(fourcc);
+ assert(idx != IDX_LAST_CHUNK);
if (IsWPI(kChunks[idx].id)) { // An image chunk.
return WEBP_MUX_INVALID_ARGUMENT;
} else if (idx != IDX_UNKNOWN) { // A known chunk type.