summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-18 15:23:54 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-18 16:47:29 +0100
commit2d5f1addbec2a1184b4e3b56dbfcb5416401a44f (patch)
treee5b3bb1861cb4c31a66454b769af2b0d238f32f7 /libavcodec
parent1a947dfa8347b3b1fe0f5bd699a10fe3dfe0ff50 (diff)
h264: fix integer overflow, assert failure
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 7d348d2338..da43f1e457 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;
}