aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-04-12 22:06:10 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-04-15 18:48:23 +0200
commit18f5256c0dc6cfb41e649ab80b0577ba33852d76 (patch)
tree4f5f87b040706f7f659c62a42bd32d169523011b
parentd31862c2b1b1fd07dcdc503193056d6c9ad28ccb (diff)
downloadffmpeg-18f5256c0dc6cfb41e649ab80b0577ba33852d76.tar.gz
avcodec/cbs_jpeg_syntax_template: Check array index in huffman_table()
Fixes: index 224 out of bounds for type 'uint8_t [224]' Fixes: 21534/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-6291612167831552 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/cbs_jpeg_syntax_template.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/cbs_jpeg_syntax_template.c b/libavcodec/cbs_jpeg_syntax_template.c
index 1ffb77d231..6eda56d623 100644
--- a/libavcodec/cbs_jpeg_syntax_template.c
+++ b/libavcodec/cbs_jpeg_syntax_template.c
@@ -89,6 +89,8 @@ static int FUNC(huffman_table)(CodedBitstreamContext *ctx, RWContext *rw,
ij = 0;
for (i = 0; i < 16; i++) {
for (j = 0; j < current->L[i]; j++) {
+ if (ij >= 224)
+ return AVERROR_INVALIDDATA;
us(8, V[ij], ij, 0, 255);
++ij;
}