aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-05 04:15:31 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-15 10:04:50 +0200
commitfd17e34217572f1f5d1c11713e4c00fb109dd5e4 (patch)
treecd6cb22a743b6e3d86e60e44f0093203881042c5 /libavcodec
parentec17706e5ca2b073a44f7c3832845b899a44ee8e (diff)
downloadffmpeg-fd17e34217572f1f5d1c11713e4c00fb109dd5e4.tar.gz
avcodec/mpeg12dec: use the correct dimensions for checking SAR
Fixes Ticket4533 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 7f45f7fc7f4977e3a0697dfa0771015b4b985e24) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpeg12dec.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index f7e57f934d..7525ee5c82 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -29,6 +29,7 @@
#include <inttypes.h>
#include "libavutil/attributes.h"
+#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/stereo3d.h"
@@ -1315,7 +1316,13 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
}
} // MPEG-2
- ff_set_sar(s->avctx, s->avctx->sample_aspect_ratio);
+ if (av_image_check_sar(s->width, s->height,
+ avctx->sample_aspect_ratio) < 0) {
+ av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n",
+ avctx->sample_aspect_ratio.num,
+ avctx->sample_aspect_ratio.den);
+ avctx->sample_aspect_ratio = (AVRational){ 0, 1 };
+ }
if ((s1->mpeg_enc_ctx_allocated == 0) ||
avctx->coded_width != s->width ||