prevent integer overflow in calculating duration
authorJohn Wimer <john@god.vtic.net>
Mon, 17 Jan 2011 15:00:17 +0000 (16:00 +0100)
committerMartin Storsjö <martin@martin.st>
Mon, 17 Jan 2011 15:05:58 +0000 (17:05 +0200)
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/applehttp.c

index 4a4611c..b73adcc 100644 (file)
@@ -306,7 +306,7 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap)
     /* If this isn't a live stream, calculate the total duration of the
      * stream. */
     if (c->finished) {
     /* If this isn't a live stream, calculate the total duration of the
      * stream. */
     if (c->finished) {
-        int duration = 0;
+        int64_t duration = 0;
         for (i = 0; i < c->variants[0]->n_segments; i++)
             duration += c->variants[0]->segments[i]->duration;
         s->duration = duration * AV_TIME_BASE;
         for (i = 0; i < c->variants[0]->n_segments; i++)
             duration += c->variants[0]->segments[i]->duration;
         s->duration = duration * AV_TIME_BASE;