aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-03-08 17:28:36 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-10-23 01:44:40 +0200
commit81a6076e4b8eb3c9bd6cb3c9c425c5053731d9f6 (patch)
tree178b119d66c52cbdda070f0ac5e4bc7bd739a040
parent7fd80d91f72ce456fba8d611727bbdac9038eda7 (diff)
downloadffmpeg-81a6076e4b8eb3c9bd6cb3c9c425c5053731d9f6.tar.gz
avformat/oggparsetheora: Do not adjust AV_NOPTS_VALUE
Fixes: Chromium bug 795653 Fixes: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long' Reported-by: Matt Wolenetz <wolenetz@google.com> Reviewed-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 02ecda4aba69670ca744ccc640391b7621f01fb0) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/oggparsetheora.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
index 5f057c3c8a..6db3d9f848 100644
--- a/libavformat/oggparsetheora.c
+++ b/libavformat/oggparsetheora.c
@@ -181,6 +181,7 @@ 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++) {
@@ -188,7 +189,10 @@ static int theora_packet(AVFormatContext *s, int idx)
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)