From ab188ff81409c074ad1a0000b434d2aa08dea10a Mon Sep 17 00:00:00 2001 From: AntonJMLarsson Date: Thu, 22 Dec 2022 10:16:49 +0100 Subject: [PATCH] overflow bug in crc combine --- src/crc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crc.rs b/src/crc.rs index cd00cebe..8a4f3c98 100644 --- a/src/crc.rs +++ b/src/crc.rs @@ -63,7 +63,7 @@ impl Crc { /// Combine the CRC with the CRC for the subsequent block of bytes. pub fn combine(&mut self, additional_crc: &Crc) { - self.amt += additional_crc.amt; + self.amt = self.amt.wrapping_add(additional_crc.amt); self.hasher.combine(&additional_crc.hasher); } }