From 95e88893123bae89991bf45a6c5db0173e158574 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sun, 8 Jun 2025 00:52:46 +0200 Subject: [PATCH 1/3] avformat/dhav: Fix check for seekability AVIOContext.seekable is a bitfield. Also check for seekability earlier. Signed-off-by: Andreas Rheinhardt --- libavformat/dhav.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/dhav.c b/libavformat/dhav.c index 31f4d75181..af1a8d86a5 100644 --- a/libavformat/dhav.c +++ b/libavformat/dhav.c @@ -237,6 +237,9 @@ static void get_timeinfo(unsigned date, struct tm *timeinfo) static int64_t get_duration(AVFormatContext *s) { + if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL)) + return 0; + int64_t start_pos = avio_tell(s->pb); int64_t end_pos = -1; int64_t start = 0, end = 0; @@ -248,9 +251,6 @@ static int64_t get_duration(AVFormatContext *s) unsigned date; int64_t size = avio_size(s->pb); - if (!s->pb->seekable) - return 0; - if (start_pos + 16 > size) return 0; -- 2.45.2