summaryrefslogtreecommitdiff
path: root/libavformat/oggparsedaala.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-03-08 17:28:36 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-03-10 02:44:45 +0100
commitf655ddfb47e8484b205b14c7f871c643ad24d701 (patch)
tree28bd1b6db8c03b6deb64a9c98ebacd6f5c5ff8b5 /libavformat/oggparsedaala.c
parent3e7c847aaf5a298b62afae12b4ecfb8e12385998 (diff)
avformat/oggparsedaala: Do not adjust AV_NOPTS_VALUE
Fixes: potential signed integer overflow Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/oggparsedaala.c')
-rw-r--r--libavformat/oggparsedaala.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/oggparsedaala.c b/libavformat/oggparsedaala.c
index a373b41b4c..e944470aca 100644
--- a/libavformat/oggparsedaala.c
+++ b/libavformat/oggparsedaala.c
@@ -218,6 +218,7 @@ static int daala_packet(AVFormatContext *s, int idx)
int seg, duration = 1;
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + idx;
+ int64_t pts;
/*
* first packet handling: here we parse the duration of each packet in the
@@ -230,7 +231,10 @@ static int daala_packet(AVFormatContext *s, int idx)
if (os->segments[seg] < 255)
duration++;
- os->lastpts = os->lastdts = daala_gptopts(s, idx, os->granule, NULL) - duration;
+ pts = daala_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 != AV_NOPTS_VALUE)