diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-10-26 00:02:57 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-11-01 22:16:01 +0100 |
commit | c1cd31b182bd187e9bf6f6187d63f79571b6aad9 (patch) | |
tree | e0c885aca60e1692d931db143b27c6370dd3a8e2 | |
parent | 84b83ecbfd4f42be64e9e125348204647d4afb01 (diff) | |
download | ffmpeg-c1cd31b182bd187e9bf6f6187d63f79571b6aad9.tar.gz |
avcodec/jpeglsdec: Check for end of bitstream in ls_decode_line()
Fixes: 1773/clusterfuzz-testcase-minimized-4832523987189760
Fixes: Timeout
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 f80224ed19a4c012549fd460d529c7c04e68cf21)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/jpeglsdec.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c index 62c8189c94..dea02ff8e8 100644 --- a/libavcodec/jpeglsdec.c +++ b/libavcodec/jpeglsdec.c @@ -224,6 +224,9 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, while (x < w) { int err, pred; + if (get_bits_left(&s->gb) <= 0) + return; + /* compute gradients */ Ra = x ? R(dst, x - stride) : R(last, x); Rb = R(last, x); |