[FFmpeg-devel] [PATCH 1/2] avcodec/cbs_jpeg_syntax_template: Check table index before use in dht()
Michael Niedermayer
michael at niedermayer.cc
Mon Apr 13 01:15:33 EEST 2020
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 at niedermayer.cc>
---
libavcodec/cbs_jpeg_syntax_template.c | 3 +++
1 file changed, 3 insertions(+)
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;
--
2.17.1
More information about the ffmpeg-devel
mailing list