This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 615032302929256507093419f8637d3f81140367
Author:     Niklas Haas <[email protected]>
AuthorDate: Mon Jun 29 16:07:15 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Mon Jul 27 17:05:20 2026 +0000

    avformat/libcurl: use int64_t consistently
    
    Instead of randomly mixing in uint64_t. As far as I can tell, we don't
    depend on defined overflow behavior anywhere, except where such would be a
    bug anyways, and I'm also pretty sure we won't exhaust the 63-bit file size
    limit of int64_t any time soon, so this is just a footgun prevention
    mechanism.
    
    We already have a few dodgy places of mixing int64_t and uint64_t values
    in the code haphazardly.
    
    Sponsored-by: nxtedition AB
    Signed-off-by: Niklas Haas <[email protected]>
---
 libavformat/libcurl.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavformat/libcurl.c b/libavformat/libcurl.c
index acd5618a41..2f3a00dbb9 100644
--- a/libavformat/libcurl.c
+++ b/libavformat/libcurl.c
@@ -126,8 +126,8 @@ struct CurlContext {
 
     /* Producer bookkeeping, touched only by the loop thread. */
     int             active;          /* currently added to the multi */
-    uint64_t        request_start;   /* absolute offset the current request 
began at */
-    uint64_t        request_received;/* bytes delivered in the current request 
*/
+    int64_t         request_start;   /* absolute offset the current request 
began at */
+    int64_t         request_received;/* bytes delivered in the current request 
*/
     int64_t         request_end;     /* expected end of request, or -1 if 
unknown */
     int             retry_count;     /* consecutive recoverable failures */
     int             is_initial;      /* using reduced request size */
@@ -362,22 +362,22 @@ static int xferinfo_callback(void *userdata, curl_off_t 
dltotal, curl_off_t dlno
 static void start_request(CurlContext *c)
 {
     if (!c->probed || c->seekable) {
-        uint64_t start = c->request_start;
+        int64_t start = c->request_start;
         char range[48];
         int64_t request_size = c->request_size;
         if (c->is_initial && c->initial_request_size > 0)
             request_size = c->initial_request_size;
         if (request_size > 0 || c->end_off > 0) {
-            uint64_t end = UINT64_MAX;
+            int64_t end = INT64_MAX;
             if (request_size > 0)
                 end = start + request_size - 1;
             if (c->content_size > 0)
-                end = FFMIN(end, (uint64_t)c->content_size - 1);
+                end = FFMIN(end, c->content_size - 1);
             if (c->end_off > 0)
-                end = FFMIN(end, (uint64_t)c->end_off - 1);
-            snprintf(range, sizeof(range), "%"PRIu64"-%"PRIu64, start, end);
+                end = FFMIN(end, c->end_off - 1);
+            snprintf(range, sizeof(range), "%"PRId64"-%"PRId64, start, end);
         } else {
-            snprintf(range, sizeof(range), "%"PRIu64"-", start);
+            snprintf(range, sizeof(range), "%"PRId64"-", start);
         }
         curl_easy_setopt(c->easy, CURLOPT_RANGE, range);
     } else {
@@ -427,7 +427,7 @@ static void update_statistics(CurlContext *c)
 /* Transfer finished (or failed) */
 static void on_done(CurlContext *c, CURLcode code)
 {
-    uint64_t received;
+    int64_t received;
     int aborted;
 
     pthread_mutex_lock(&c->mutex);
@@ -473,7 +473,7 @@ static void on_done(CurlContext *c, CURLcode code)
         c->retry_count < c->max_retries) {
         c->retry_count++;
         c->loop->num_retries++;
-        av_log(c->h, AV_LOG_WARNING, "%s, retrying (#%d) from %"PRIu64"\n",
+        av_log(c->h, AV_LOG_WARNING, "%s, retrying (#%d) from %"PRId64"\n",
                curl_easy_strerror(code), c->retry_count, c->request_start);
         start_request(c);
         return;

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to