]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/loco: Limit lossy parameter so it is sane and does not overflow
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 15 Jun 2019 19:47:16 +0000 (21:47 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 25 Jun 2019 11:30:09 +0000 (13:30 +0200)
Fixes: 15248/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LOCO_fuzzer-5087440458481664
Fixes: signed integer overflow: 3 + 2147483647 cannot be represented in type 'int'
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/loco.c

index 741db3bdcece517cb6b0216a32f3d7e4b5f1aac0..e8c62b8178bec1f06070e4dca0efd74fbba4437d 100644 (file)
@@ -295,6 +295,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
         avpriv_request_sample(avctx, "LOCO codec version %i", version);
     }
 
+    if (l->lossy > 65536U) {
+        av_log(avctx, AV_LOG_ERROR, "lossy %i is too large\n", l->lossy);
+        return AVERROR_INVALIDDATA;
+    }
+
     l->mode = AV_RL32(avctx->extradata + 4);
     switch (l->mode) {
     case LOCO_CYUY2: