diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-02-18 20:18:19 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-02-18 20:37:17 +0100 |
commit | 6cd650dbd2bea006e1c4b70456f6d9eb7f638922 (patch) | |
tree | 233280cb465cf3ca5ce19d244cc221087260392e /libavformat | |
parent | 695a766bff4cd8414a84e58159506d72b4e44892 (diff) |
ff_gen_search: Fix finding the maximum timestamp in a really small file
Fixes Assertion failure
Found-by: durandal_1707
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/utils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index d59a02d951..a4218db8ed 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1863,10 +1863,10 @@ int64_t ff_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, filesize = avio_size(s->pb); pos_max = filesize - 1; do{ - pos_max -= step; + pos_max = FFMAX(0, pos_max - step); ts_max = ff_read_timestamp(s, stream_index, &pos_max, pos_max + step, read_timestamp); step += step; - }while(ts_max == AV_NOPTS_VALUE && pos_max >= step); + }while(ts_max == AV_NOPTS_VALUE && pos_max > 0); if (ts_max == AV_NOPTS_VALUE) return -1; |