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

Git pushed a commit to branch master
in repository ffmpeg.

commit 284f1f1ea908da6a789b2f6285cdb3f06a5a6a0a
Author:     Kacper Michajłow <[email protected]>
AuthorDate: Sun Sep 13 02:22:49 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Wed Sep 23 16:50:07 2026 +0200

    avutil/file: use a 64 bit fstat() on Windows
    
    struct stat has a 32 bit st_size with the Windows SDK, so fstat()
    fails with EOVERFLOW on files of 2 GiB and more and av_file_map()
    cannot map them. Use the _stat64 variants on Windows, like libavformat
    already does, and drop the off_t intermediate, which is 32 bits wide
    there as well.
    
    Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavutil/file.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/libavutil/file.c b/libavutil/file.c
index 4ef940a6c3..4c5632ff50 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -37,6 +37,14 @@
 #include <windows.h>
 #endif
 
+#ifdef _WIN32
+/* struct stat has a 32 bit st_size with the Windows SDK, use the 64 bit 
variants */
+#undef stat
+#undef fstat
+#define stat  _stat64
+#define fstat _fstat64
+#endif
+
 typedef struct FileLogContext {
     const AVClass *class;
     int   log_offset;
@@ -59,7 +67,6 @@ int av_file_map(const char *filename, uint8_t **bufptr, 
size_t *size,
     int err, fd = avpriv_open(filename, O_RDONLY);
     struct stat st;
     av_unused void *ptr;
-    off_t off_size;
     *bufptr = NULL;
     *size = 0;
 
@@ -76,14 +83,13 @@ int av_file_map(const char *filename, uint8_t **bufptr, 
size_t *size,
         return err;
     }
 
-    off_size = st.st_size;
-    if (off_size > SIZE_MAX) {
+    if (st.st_size > SIZE_MAX) {
         av_log(&file_log_ctx, AV_LOG_ERROR,
                "File size for file '%s' is too big\n", filename);
         close(fd);
         return AVERROR(EINVAL);
     }
-    *size = off_size;
+    *size = st.st_size;
 
     if (!*size) {
         *bufptr = NULL;

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to