]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/photocd: Use ff_set_dimensions()
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 20 Sep 2020 19:29:15 +0000 (21:29 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 18 Oct 2020 18:42:21 +0000 (20:42 +0200)
Fixes: out of memory
Fixes: 25588/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PHOTOCD_fuzzer-6612945080156160
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/photocd.c

index 8fd4536a650bf43b48f70c4adb760158cd4074e4..aa1b1059e98d4c2c8eb71a5a2182ed2d65691b9e 100644 (file)
@@ -323,8 +323,9 @@ static int photocd_decode_frame(AVCodecContext *avctx, void *data,
     else
         s->resolution = av_clip(4 - s->lowres, 0, 4);
 
-    avctx->width  = img_info[s->resolution].width;
-    avctx->height = img_info[s->resolution].height;
+    ret = ff_set_dimensions(avctx, img_info[s->resolution].width, img_info[s->resolution].height);
+    if (ret < 0)
+        return ret;
 
     if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
         return ret;