]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ffv1dec.c
avcodec/mpegvideo: dont overwrite emu_edge buffer
[ffmpeg] / libavcodec / ffv1dec.c
index a0a50abed4dfe6612321c3fc84de0b25895c2904..b10e212ce554504bd9ccce72408cf14e8b87e999 100644 (file)
@@ -330,6 +330,15 @@ static int decode_slice_header(FFV1Context *f, FFV1Context *fs)
     }
     f->cur->sample_aspect_ratio.num = get_symbol(c, state, 0);
     f->cur->sample_aspect_ratio.den = get_symbol(c, state, 0);
+
+    if (av_image_check_sar(f->width, f->height,
+                           f->cur->sample_aspect_ratio) < 0) {
+        av_log(f->avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n",
+               f->cur->sample_aspect_ratio.num,
+               f->cur->sample_aspect_ratio.den);
+        f->cur->sample_aspect_ratio = (AVRational){ 0, 1 };
+    }
+
     if (fs->version > 3) {
         fs->slice_reset_contexts = get_rac(c, state);
         fs->slice_coding_mode = get_symbol(c, state, 0);
@@ -342,6 +351,7 @@ static int decode_slice_header(FFV1Context *f, FFV1Context *fs)
             }
         }
     }
+
     return 0;
 }