aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-10-26 00:02:57 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-10-29 18:28:40 +0100
commitf80224ed19a4c012549fd460d529c7c04e68cf21 (patch)
treeaa40b16137ac6f53cbdb0b8ccb891a61c5209721
parentfe533628b9604e2f8e5179d5c5dd17c3cb764265 (diff)
downloadffmpeg-f80224ed19a4c012549fd460d529c7c04e68cf21.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>
-rw-r--r--libavcodec/jpeglsdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index cb2f89a88c..5308b744df 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -233,6 +233,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);