[PR] avformat/http: treat Content-Range "*" total as unknown, not 0 (PR #24216)

adorn via ffmpeg-devel <[email protected]>
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <[email protected]>
PR #24216 opened by adorn
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24216
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24216.patch

RFC 7233 allows an unknown complete-length ("bytes A-B/*"). strtoull("*")
returns 0, which clobbered a previously known filesize and made avio_size()
return 0 - breaking duration estimation over HTTP (e.g. N/A for CBR MP3 and
for WAV with a chunk after data).

Fixes #24210

# Summary of changes

Briefly describe what this PR does and why.

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From fbb9f527221b181d8dd240fcce23c11c5264ac26 Mon Sep 17 00:00:00 2001
From: Andreas Menze <[email protected]>
Date: Thu, 20 Aug 2026 10:58:09 +0200
Subject: [PATCH] avformat/http: treat Content-Range "*" total as unknown, not
 0

RFC 7233 allows an unknown complete-length ("bytes A-B/*"). strtoull("*")
returns 0, which clobbered a previously known filesize and made avio_size()
return 0 - breaking duration estimation over HTTP (e.g. N/A for CBR MP3 and
for WAV with a chunk after data).

Fixes #24210
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 719d3c2ef5..756f09b1c9 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -928,7 +928,7 @@ static void parse_content_range(URLContext *h, const char *p)
         s->off = strtoull(p, NULL, 10);
         if ((end = strchr(p, '-')) && strlen(end) > 0)
             s->range_end = strtoull(end + 1, NULL, 10) + 1;
-        if ((slash = strchr(p, '/')) && strlen(slash) > 0)
+        if ((slash = strchr(p, '/')) && strlen(slash) > 0 && slash[1] != '*')
             s->filesize_from_content_range = strtoull(slash + 1, NULL, 10);
     }
     if (s->seekable == -1 && (!s->is_akamai || s->filesize != 2147483647))
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.