[FFmpeg-cvslog] avcodec/jpeglsdec: Check for end of bitstream in ls_decode_line()

Michael Niedermayer git at videolan.org
Thu Feb 1 01:51:01 EET 2018


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Thu Oct 26 00:02:57 2017 +0200| [9ba9c5a16f476e5b0d5f7570416d596d89d310c9] | committer: Michael Niedermayer

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 at niedermayer.cc>
(cherry picked from commit f80224ed19a4c012549fd460d529c7c04e68cf21)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ba9c5a16f476e5b0d5f7570416d596d89d310c9
---

 libavcodec/jpeglsdec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index 60701d69fd..5e0a3d2978 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);



More information about the ffmpeg-cvslog mailing list