aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-26 16:17:55 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-26 16:24:23 +0100
commit386fc67c79b746760711be60e69fd5a10f42ab5f (patch)
treec36a4a9ff880fd40b2b9ffbb79f44aa259cb3581 /libavformat/utils.c
parenta3f30f2e995c3d72664e28a43bec41c4b13ef909 (diff)
parent7709ce029a7bc101b9ac1ceee607cda10dcb89dc (diff)
downloadffmpeg-386fc67c79b746760711be60e69fd5a10f42ab5f.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: lavf: avoid integer overflow in ff_compute_frame_duration() Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 2f22571057..3e87dbc76e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -826,7 +826,10 @@ void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st,
*pnum = st->codec->time_base.num;
*pden = st->codec->time_base.den;
if (pc && pc->repeat_pict) {
- *pnum = (*pnum) * (1 + pc->repeat_pict);
+ if (*pnum > INT_MAX / (1 + pc->repeat_pict))
+ *pden /= 1 + pc->repeat_pict;
+ else
+ *pnum *= 1 + pc->repeat_pict;
}
//If this codec can be interlaced or progressive then we need a parser to compute duration of a packet
//Thus if we have no parser in such case leave duration undefined.