1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
Michael Niedermayer 2020-04-12 22:06:10 +02:00
parent d31862c2b1
commit 18f5256c0d

View File

@ -89,6 +89,8 @@ static int FUNC(huffman_table)(CodedBitstreamContext *ctx, RWContext *rw,
ij = 0; ij = 0;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
for (j = 0; j < current->L[i]; j++) { for (j = 0; j < current->L[i]; j++) {
if (ij >= 224)
return AVERROR_INVALIDDATA;
us(8, V[ij], ij, 0, 255); us(8, V[ij], ij, 0, 255);
++ij; ++ij;
} }