]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/cscd: Check output buffer size for lzo.
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 21 Jun 2018 23:18:20 +0000 (01:18 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 25 Jun 2018 20:58:45 +0000 (22:58 +0200)
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
libavcodec/cscd.c

index 35c4ee08c35282170b989cb5310c3664e3cd5850..5eb511a5659183f4c2592b8d83db6313804b80a6 100644 (file)
@@ -81,7 +81,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     switch ((buf[0] >> 1) & 7) {
         case 0: { // lzo compression
             int outlen = c->decomp_size, inlen = buf_size - 2;
-            if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen)) {
+            if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen) || outlen) {
                 av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
                 return AVERROR_INVALIDDATA;
             }