diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-01-08 23:40:54 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-01-16 01:29:18 +0100 |
commit | 51978aefe8074cc3e020994f6b329387b2149cb8 (patch) | |
tree | ec3a46f11b40d0a1f868079c3c899ef1b6e2792b /libavcodec/dirac_arith.h | |
parent | 6ed3d0e01c20aba7ef3984c0b8965d26e9f4990c (diff) |
avcodec/dirac_arith: Treat overread as error
Fixes: Timeout
Fixes: 11663/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5636791864918016
Before:Executed clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5636791864918016 in 26006 ms
After: Executed clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5636791864918016 in 106 ms
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/dirac_arith.h')
-rw-r--r-- | libavcodec/dirac_arith.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/dirac_arith.h b/libavcodec/dirac_arith.h index efe30b79de..79526a7ca3 100644 --- a/libavcodec/dirac_arith.h +++ b/libavcodec/dirac_arith.h @@ -82,6 +82,7 @@ typedef struct { uint16_t contexts[DIRAC_CTX_COUNT]; int error; + int overread; } DiracArith; extern const uint8_t ff_dirac_next_ctx[DIRAC_CTX_COUNT]; @@ -119,6 +120,9 @@ static inline void refill(DiracArith *c) new |= 0xff00; c->bytestream = c->bytestream_end; + c->overread ++; + if (c->overread > 4) + c->error = AVERROR_INVALIDDATA; } c->low += new << counter; |