diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-10-15 23:42:50 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-01 12:49:26 +0200 |
commit | 120ab2375c2c1a8da904cfeb632af10b04015c4a (patch) | |
tree | e553430c409da8e0bd3bc9c87dd0c15dba4aa061 | |
parent | 47e60b2020b2fee0a942e4f4f9c023a4694ff2b1 (diff) | |
download | ffmpeg-120ab2375c2c1a8da904cfeb632af10b04015c4a.tar.gz |
avcodec/dstdec: Check that AC probabilities are within range
ISO/IEC 14496-3:2005(E): "Each entry of P_one[ ][ ] is in the range of 1 to
128, corresponding to a probability of 1/256 to 128/256 of the next error bit (bit E, See Figure 10.5)..."
Fixes: Timeout (42sec ->1sec)
Fixes: 18181/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5736646250594304
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 0c3e1b395b47fac44397604b2a3343c4bd92561c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/dstdec.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c index 51ca810c05..daf906ba0c 100644 --- a/libavcodec/dstdec.c +++ b/libavcodec/dstdec.c @@ -161,6 +161,10 @@ static int read_table(GetBitContext *gb, Table *t, const int8_t code_pred_coeff[ c -= (x + 4) / 8; else c += (-x + 3) / 8; + if (!is_signed) { + if (c < offset || c >= offset + (1<<coeff_bits)) + return AVERROR_INVALIDDATA; + } t->coeff[i][j] = c; } } |