Commit e5c338ba authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/utils: assert position monotonicity in ff_find_last_ts()

This ensures that no read timestamp functions finds packets before the search window in ff_find_last_ts()
which could cause an infinite loop
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent a6609919
...@@ -1779,6 +1779,7 @@ int ff_find_last_ts(AVFormatContext *s, int stream_index, int64_t *ts, int64_t * ...@@ -1779,6 +1779,7 @@ int ff_find_last_ts(AVFormatContext *s, int stream_index, int64_t *ts, int64_t *
int64_t tmp_ts = ff_read_timestamp(s, stream_index, &tmp_pos, INT64_MAX, read_timestamp); int64_t tmp_ts = ff_read_timestamp(s, stream_index, &tmp_pos, INT64_MAX, read_timestamp);
if(tmp_ts == AV_NOPTS_VALUE) if(tmp_ts == AV_NOPTS_VALUE)
break; break;
av_assert0(tmp_pos > pos_max);
ts_max = tmp_ts; ts_max = tmp_ts;
pos_max = tmp_pos; pos_max = tmp_pos;
if(tmp_pos >= filesize) if(tmp_pos >= filesize)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment