summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-05 04:15:31 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-05 04:33:44 +0200
commit7f45f7fc7f4977e3a0697dfa0771015b4b985e24 (patch)
treef13e54d7794c93f06a688b53663ce2b5116df21d
parent6ef3426d90a316d710476326aa863b1c56f9c2a0 (diff)
avcodec/mpeg12dec: use the correct dimensions for checking SAR
Fixes Ticket4533 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/mpeg12dec.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index efbd53e529..58505cedbb 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 ||