bug-cpio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH resend] Wrong CRC with ASCII CRC for large files


From: Dominique Martinet
Subject: [PATCH resend] Wrong CRC with ASCII CRC for large files
Date: Fri, 7 Apr 2023 09:38:47 +0900

From: Stefano Babic <sbabic@denx.de>

Due to signedness, the checksum is not computed when filesize is bigger
a 2GB.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
This patch was originally sent to bugs-cpio in 2017 but seems to have
gotten lost:
https://lists.gnu.org/archive/html/bug-cpio/2017-07/msg00004.html

It has since been handpicked and made its way into yocto[1] and
debian[2], seemingly without issue so I'm giving sending this again
another try (I did not see any other attempt to send this again since
2017).
[1] 
https://github.com/yoctoproject/poky/commit/c9f2486c527596a0c2657538a32de3fc3d43fe79
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=962188

 src/copyout.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/copyout.c b/src/copyout.c
index 1f0987a..727aeca 100644
--- a/src/copyout.c
+++ b/src/copyout.c
@@ -34,13 +34,13 @@
    compute and return a checksum for them.  */
 
 static uint32_t
-read_for_checksum (int in_file_des, int file_size, char *file_name)
+read_for_checksum (int in_file_des, unsigned int file_size, char *file_name)
 {
   uint32_t crc;
   char buf[BUFSIZ];
-  int bytes_left;
-  int bytes_read;
-  int i;
+  unsigned int bytes_left;
+  unsigned int bytes_read;
+  unsigned int i;
 
   crc = 0;
 
-- 
2.7.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]