Browse code

avcodec/cscd: Check output buffer size for lzo.

Fixes: Timeout
Fixes: 8665/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CSCD_fuzzer-5768442610188288

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
(cherry picked from commit 78167b498f53c36c31105a2bf11e90b03637598f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

Michael Niedermayer authored on 2018/06/22 08:18:20
Showing 1 changed files
... ...
@@ -81,7 +81,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
81 81
     switch ((buf[0] >> 1) & 7) {
82 82
         case 0: { // lzo compression
83 83
             int outlen = c->decomp_size, inlen = buf_size - 2;
84
-            if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen)) {
84
+            if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen) || outlen) {
85 85
                 av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
86 86
                 return AVERROR_INVALIDDATA;
87 87
             }