From: Dominik Csapak Date: Thu, 4 Jun 2020 08:12:10 +0000 (+0200) Subject: fix csum calculation of not 'chunk_size' aligned images X-Git-Tag: v0.2.3~2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=a95a3fb8939efaa7c07e3836d71ba14e0a3c8a0b;p=proxmox-backup.git fix csum calculation of not 'chunk_size' aligned images the last chunk does not have to be as big as the chunk_size, just use the already available 'chunk_end' function which does the correct thing this fixes restoration of images whose sizes are not a multiple of 'chunk_size' as well Signed-off-by: Dominik Csapak --- diff --git a/src/backup/fixed_index.rs b/src/backup/fixed_index.rs index f21b2d03..23a7f03d 100644 --- a/src/backup/fixed_index.rs +++ b/src/backup/fixed_index.rs @@ -198,7 +198,7 @@ impl FixedIndexReader { let mut csum = openssl::sha::Sha256::new(); let mut chunk_end = 0; for pos in 0..self.index_length { - chunk_end = ((pos + 1) * self.chunk_size) as u64; + chunk_end = self.chunk_end(pos); let digest = self.chunk_digest(pos); csum.update(digest); }