[FFmpeg-cvslog] avcodec/mpeg12dec: use the correct dimensions for checking SAR

Michael Niedermayer git at videolan.org
Sat May 16 00:16:12 CEST 2015


ffmpeg | branch: release/2.6 | Michael Niedermayer <michaelni at gmx.at> | Tue May  5 04:15:31 2015 +0200| [fd17e34217572f1f5d1c11713e4c00fb109dd5e4] | committer: Michael Niedermayer

avcodec/mpeg12dec: use the correct dimensions for checking SAR

Fixes Ticket4533

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 7f45f7fc7f4977e3a0697dfa0771015b4b985e24)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fd17e34217572f1f5d1c11713e4c00fb109dd5e4
---

 libavcodec/mpeg12dec.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index f7e57f9..7525ee5 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                ||



More information about the ffmpeg-cvslog mailing list