]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix: Avoid util::fallocate size overflow for very large files on Windows
authorJoel Rosdahl <joel@rosdahl.net>
Fri, 17 Jul 2026 14:52:58 +0000 (16:52 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 19 Jul 2026 15:18:34 +0000 (17:18 +0200)
src/ccache/util/file.cpp

index bb7cef288ac5be3ab4e4c13a7b381eb58d67f65c..5c291615711c6624eff44a4599f06dedf11efc5b 100644 (file)
@@ -257,7 +257,7 @@ fallocate(int fd, size_t new_size)
     lseek(fd, saved_pos, SEEK_SET);
     return {};
   }
-  long bytes_to_write = new_size - old_size;
+  size_t bytes_to_write = new_size - static_cast<size_t>(old_size);
 
   void* buf = calloc(bytes_to_write, 1);
   if (!buf) {