diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2014-04-28 16:08:33 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2014-06-20 10:39:33 -0400 |
commit | 9e500efdbe0deeff1602500ebc229a0a6b6bb1a2 (patch) | |
tree | ab9fefcc3d3bab4d2a75f427e96587fd61ec2770 /libavcodec/ffv1dec.c | |
parent | d349afb07bacccb62eb5369c38d6406d2909d792 (diff) | |
download | ffmpeg-9e500efdbe0deeff1602500ebc229a0a6b6bb1a2.tar.gz |
Add av_image_check_sar() and use it to validate SAR
Diffstat (limited to 'libavcodec/ffv1dec.c')
-rw-r--r-- | libavcodec/ffv1dec.c | 8 |
1 files changed, 8 insertions, 0 deletions
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; } |