Skip to content

Commit

Permalink
avformat/oggparsetheora: Do not adjust AV_NOPTS_VALUE
Browse files Browse the repository at this point in the history
Fixes: Chromium bug 795653
Fixes: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long'
Reported-by: Matt Wolenetz <[email protected]>
Reviewed-by: Matt Wolenetz <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed Mar 10, 2018
1 parent 8d37dd6 commit 02ecda4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libavformat/oggparsetheora.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,18 @@ static int theora_packet(AVFormatContext *s, int idx)

if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && !(os->flags & OGG_FLAG_EOS)) {
int seg;
int64_t pts;

duration = 1;
for (seg = os->segp; seg < os->nsegs; seg++) {
if (os->segments[seg] < 255)
duration ++;
}

os->lastpts = os->lastdts = theora_gptopts(s, idx, os->granule, NULL) - duration;
pts = theora_gptopts(s, idx, os->granule, NULL);
if (pts != AV_NOPTS_VALUE)
pts -= duration;
os->lastpts = os->lastdts = pts;
if(s->streams[idx]->start_time == AV_NOPTS_VALUE) {
s->streams[idx]->start_time = os->lastpts;
if (s->streams[idx]->duration > 0)
Expand Down

0 comments on commit 02ecda4

Please sign in to comment.