Don't manipulate duration when it's AV_NOPTS_VALUE.

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 c5fd57f483)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Dale Curtis 2017-11-28 14:26:55 -08:00 committed by Michael Niedermayer
parent 17bfddeb39
commit b40b3ddcfc
1 changed files with 1 additions and 1 deletions

View 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; os->lastpts = os->lastdts = vp8_gptopts(s, idx, os->granule, NULL) - duration;
if(s->streams[idx]->start_time == AV_NOPTS_VALUE) { if(s->streams[idx]->start_time == AV_NOPTS_VALUE) {
s->streams[idx]->start_time = os->lastpts; 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; s->streams[idx]->duration -= s->streams[idx]->start_time;
} }
} }