From f586e036abd8a744ef8b650071e22d873e0cdacc Mon Sep 17 00:00:00 2001 From: bayesiandog Date: Sat, 1 Mar 2025 15:45:42 +0200 Subject: [PATCH] Fix seeking beyond file duration by returning an error when metadata is incorrect --- libavformat/seek.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/seek.c b/libavformat/seek.c index 9518f0f41c..90b374b332 100644 --- a/libavformat/seek.c +++ b/libavformat/seek.c @@ -668,8 +668,8 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int ret; if (ts > s->duration) { - av_log(NULL, AV_LOG_ERROR, "Seek position (%d) is larger than file duration (%d). Exiting...\n", ts, s->duration); - exit(1); + av_log(NULL, AV_LOG_ERROR, "Seek position (%lld) is larger than file duration (%lld). Check metadata...\n", ts, s->duration); + return AVERROR_INVALIDDATA; } if (min_ts > ts || max_ts < ts) -- 2.39.5