From 9e500efdbe0deeff1602500ebc229a0a6b6bb1a2 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Mon, 28 Apr 2014 16:08:33 -0400 Subject: Add av_image_check_sar() and use it to validate SAR --- libavcodec/ffv1dec.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libavcodec/ffv1dec.c') diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index 8f7b2bf32e..703491ecd8 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -328,6 +328,14 @@ 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 }; + } + return 0; } -- cgit v1.2.3