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 f80224ed19)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2017-10-26 00:02:57 +02:00
parent 84b83ecbfd
commit c1cd31b182
1 changed files with 3 additions and 0 deletions

View File

@ -224,6 +224,9 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s,
while (x < w) { while (x < w) {
int err, pred; int err, pred;
if (get_bits_left(&s->gb) <= 0)
return;
/* compute gradients */ /* compute gradients */
Ra = x ? R(dst, x - stride) : R(last, x); Ra = x ? R(dst, x - stride) : R(last, x);
Rb = R(last, x); Rb = R(last, x);