mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-03 05:10:03 +02:00
avformat/utils: Check start/end before computing duration in update_stream_timings()
Fixes undefined behavior
Fixes: 637428.ogg
Found-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 90da187f1d
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
6bee6ef0c2
commit
66e8f87ebc
@ -2402,11 +2402,14 @@ static void update_stream_timings(AVFormatContext *ic)
|
||||
if (ic->nb_programs) {
|
||||
for (i = 0; i < ic->nb_programs; i++) {
|
||||
p = ic->programs[i];
|
||||
if (p->start_time != AV_NOPTS_VALUE && p->end_time > p->start_time)
|
||||
if (p->start_time != AV_NOPTS_VALUE &&
|
||||
p->end_time > p->start_time &&
|
||||
p->end_time - (uint64_t)p->start_time <= INT64_MAX)
|
||||
duration = FFMAX(duration, p->end_time - p->start_time);
|
||||
}
|
||||
} else
|
||||
} else if (end_time >= start_time && end_time - (uint64_t)start_time <= INT64_MAX) {
|
||||
duration = FFMAX(duration, end_time - start_time);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (duration != INT64_MIN && duration > 0 && ic->duration == AV_NOPTS_VALUE) {
|
||||
|
Loading…
Reference in New Issue
Block a user