]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/vc1dec: Free sprite_output_frame on error
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 16 Dec 2019 22:31:22 +0000 (23:31 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 28 Dec 2019 10:20:48 +0000 (11:20 +0100)
Fixes: memleaks
Fixes: 19471/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5688035714269184
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/vc1dec.c

index d1ca2afb4b93eb31162942733fa952a4385fafee..239f46794c2098e8dd19ac1eb99fc8b4abac5bd1 100644 (file)
@@ -576,14 +576,21 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
         if (v->sprite_width  > 1 << 14 ||
             v->sprite_height > 1 << 14 ||
             v->output_width  > 1 << 14 ||
-            v->output_height > 1 << 14) return -1;
+            v->output_height > 1 << 14) {
+            ret = -1;
+            goto error;
+        }
 
         if ((v->sprite_width&1) || (v->sprite_height&1)) {
             avpriv_request_sample(avctx, "odd sprites support");
-            return AVERROR_PATCHWELCOME;
+            ret = AVERROR_PATCHWELCOME;
+            goto error;
         }
     }
     return 0;
+error:
+    av_frame_free(&v->sprite_output_frame);
+    return ret;
 }
 
 /** Close a VC1/WMV3 decoder