Don't manipulate duration when it's AV_NOPTS_VALUE.
authorDale Curtis <dalecurtis@chromium.org>
Tue, 28 Nov 2017 22:26:55 +0000 (14:26 -0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 1 Dec 2017 23:14:19 +0000 (00:14 +0100)
This leads to signed integer overflow.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit c5fd57f483d2ad8e34551b78509f1e14136f73c0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/oggparsevp8.c

index 5959d32..e3ca775 100644 (file)
@@ -116,7 +116,7 @@ static int vp8_packet(AVFormatContext *s, int idx)
         os->lastpts = os->lastdts = vp8_gptopts(s, idx, os->granule, NULL) - duration;
         if(s->streams[idx]->start_time == AV_NOPTS_VALUE) {
             s->streams[idx]->start_time = os->lastpts;
-            if (s->streams[idx]->duration)
+            if (s->streams[idx]->duration && s->streams[idx]->duration != AV_NOPTS_VALUE)
                 s->streams[idx]->duration -= s->streams[idx]->start_time;
         }
     }