]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Force intermediate to uint64_t to make UBSAN happy.
authorJoerg Sonnenberger <joerg@bec.de>
Mon, 7 Jan 2019 18:33:25 +0000 (19:33 +0100)
committerJoerg Sonnenberger <joerg@bec.de>
Mon, 7 Jan 2019 18:33:25 +0000 (19:33 +0100)
Reported-By: OSS-Fuzz issue 10843
libarchive/archive_read_support_format_rar5.c

index 9314f7a9f9c3f0d388cfa90b7c86220e626432c2..31f9dd530e122b7f61444364c6f25b5ad3b7f1d0 100644 (file)
@@ -873,7 +873,7 @@ static int read_var(struct archive_read* a, uint64_t* pvalue,
 
         /* Strip the MSB from the input byte and add the resulting number
          * to the `result`. */
-        result += (b & 0x7F) << shift;
+        result += (b & (uint64_t)0x7F) << shift;
 
         /* MSB set to 1 means we need to continue decoding process. MSB set
          * to 0 means we're done.