[FFmpeg-cvslog] h264: fix integer overflow, assert failure

Michael Niedermayer git at videolan.org
Sun Nov 18 16:48:13 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Nov 18 15:23:54 2012 +0100| [2d5f1addbec2a1184b4e3b56dbfcb5416401a44f] | committer: Michael Niedermayer

h264: fix integer overflow, assert failure

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/h264.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 7d348d2..da43f1e 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1104,8 +1104,12 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
     h->x264_build   = -1;
     ff_h264_reset_sei(h);
     if (avctx->codec_id == AV_CODEC_ID_H264) {
-        if (avctx->ticks_per_frame == 1)
-            s->avctx->time_base.den *= 2;
+        if (avctx->ticks_per_frame == 1) {
+            if(s->avctx->time_base.den < INT_MAX/2) {
+                s->avctx->time_base.den *= 2;
+            } else
+                s->avctx->time_base.num /= 2;
+        }
         avctx->ticks_per_frame = 2;
     }
 



More information about the ffmpeg-cvslog mailing list