From d9955ce11b69eca8d0caaa5dd4a65db1f78bf77d Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sun, 4 Mar 2012 08:51:58 +0100 Subject: [PATCH] Silently error out when pos_limit exceeds pos_max instead of aborting the process. --- libavformat/seek.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/seek.c b/libavformat/seek.c index 9ac133bf23..a6d635bb4b 100644 --- a/libavformat/seek.c +++ b/libavformat/seek.c @@ -438,7 +438,10 @@ int64_t ff_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, av_log(s, AV_LOG_TRACE, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%s dts_max=%s\n", pos_min, pos_max, av_ts2str(ts_min), av_ts2str(ts_max)); - av_assert0(pos_limit <= pos_max); + if (pos_limit > pos_max) { + av_log(s, AV_LOG_ERROR, "pos_limit (0x%"PRIx64") > pos_max (0x%"PRIx64"), pos (0x%"PRIx64")\n", pos_limit, pos_max, pos); + return -1; + } if (no_change == 0) { int64_t approximate_keyframe_distance = pos_max - pos_limit;