diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-04-12 21:38:55 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-04-15 18:48:23 +0200 |
commit | d31862c2b1b1fd07dcdc503193056d6c9ad28ccb (patch) | |
tree | 910ba2d47cde9d2ebd3d5ab6bbf5134c6763a733 | |
parent | 07ecc4615c3ef5cc2fc61209a845cffd0c073b13 (diff) | |
download | ffmpeg-d31862c2b1b1fd07dcdc503193056d6c9ad28ccb.tar.gz |
avcodec/cbs_jpeg_syntax_template: Check table index before use in dht()
Fixes: out of array access
Fixes: 21515/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5766121576988672
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.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/cbs_jpeg_syntax_template.c b/libavcodec/cbs_jpeg_syntax_template.c index d3cd9ff62e..1ffb77d231 100644 --- a/libavcodec/cbs_jpeg_syntax_template.c +++ b/libavcodec/cbs_jpeg_syntax_template.c @@ -108,6 +108,9 @@ static int FUNC(dht)(CodedBitstreamContext *ctx, RWContext *rw, n = 2; for (i = 0; n < current->Lh; i++) { + if (i >= 8) + return AVERROR_INVALIDDATA; + CHECK(FUNC(huffman_table)(ctx, rw, ¤t->table[i])); ++n; |