diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-06-18 14:37:38 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-07-01 19:01:31 +0200 |
commit | b3d8e13a88c1e32ce5600687c67cbae6f0aeaeac (patch) | |
tree | 815fea9c1820e4237e00db1415fce812c2238d34 | |
parent | 3cf212f6c8c7ef5cc8400510bc32045c6058893f (diff) | |
download | ffmpeg-b3d8e13a88c1e32ce5600687c67cbae6f0aeaeac.tar.gz |
avcodec/cbs_av1: Fix writing uvlc numbers >= INT_MAX
Fixes: assertion failure
Fixes: left shift of 1 by 31 places cannot be represented in type 'int'
Fixes: 23264/clusterfuzz-testcase-minimized-ffmpeg_BSF_AV1_METADATA_fuzzer-6308429248593920
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
(cherry picked from commit 6f06c17a55137855c67ba4a7b6778ca34ddbbe6b)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r-- | libavcodec/cbs_av1.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c index 29b316e011..0abcba9c60 100644 --- a/libavcodec/cbs_av1.c +++ b/libavcodec/cbs_av1.c @@ -125,8 +125,9 @@ static int cbs_av1_write_uvlc(CodedBitstreamContext *ctx, PutBitContext *pbc, put_bits(pbc, 1, 1); } else { zeroes = av_log2(value + 1); - v = value - (1 << zeroes) + 1; - put_bits(pbc, zeroes + 1, 1); + v = value - (1U << zeroes) + 1; + put_bits(pbc, zeroes, 0); + put_bits(pbc, 1, 1); put_bits(pbc, zeroes, v); } |