]> git.proxmox.com Git - proxmox-backup.git/commitdiff
fix csum calculation of not 'chunk_size' aligned images
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 4 Jun 2020 08:12:10 +0000 (10:12 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 4 Jun 2020 08:18:30 +0000 (10:18 +0200)
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 <d.csapak@proxmox.com>
src/backup/fixed_index.rs

index f21b2d03905e67926f656dc276fd3f4c4269d13a..23a7f03db2a712f53eb25d065dce8e774418a733 100644 (file)
@@ -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);
         }