avcodec/cbs_av1: Check leb128 values read

"It is a requirement of bitstream conformance that the value returned from the leb128 parsing process is less than or equal
to (1 << 32) - 1."

Fixes: assertion failure
Fixes: 19293/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5749508361420800

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a70d836364)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2019-12-12 23:50:27 +01:00
parent cc7760b009
commit 1c2b1c0428
1 changed files with 3 additions and 0 deletions

View File

@ -170,6 +170,9 @@ static int cbs_av1_read_leb128(CodedBitstreamContext *ctx, GetBitContext *gbc,
break;
}
if (value > UINT32_MAX)
return AVERROR_INVALIDDATA;
if (ctx->trace_enable)
ff_cbs_trace_syntax_element(ctx, position, name, NULL, "", value);