Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 26 Nov 2012 15:17:55 +0000 (16:17 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 26 Nov 2012 15:24:23 +0000 (16:24 +0100)
* qatar/master:
  lavf: avoid integer overflow in ff_compute_frame_duration()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/utils.c

index 2f22571..3e87dbc 100644 (file)
@@ -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.