[ostree] rollsum: Fix assertion for CRC matches



commit b89326ac41f48f921e89717cf106a609a9e52190
Author: Colin Walters <walters verbum org>
Date:   Tue Aug 25 09:26:22 2015 -0400

    rollsum: Fix assertion for CRC matches
    
    It's possible for two blocks to have the same CRC but different
    length.  Rather than asserting, treat them as not matching.

 src/libostree/ostree-rollsum.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/libostree/ostree-rollsum.c b/src/libostree/ostree-rollsum.c
index a200765..7e9190c 100644
--- a/src/libostree/ostree-rollsum.c
+++ b/src/libostree/ostree-rollsum.c
@@ -162,7 +162,10 @@ _ostree_compute_rollsum_matches (GBytes                           *from,
                   g_variant_get (from_chunk, "(utt)", &fromcrc, &from_start, &from_offset);
 
                   g_assert (fromcrc == tocrc);
-                  g_assert (to_offset == from_offset);
+
+                  /* Same crc32 but different length, skip it.  */
+                  if (to_offset != from_offset)
+                    continue;
                   
                   /* Rsync uses a cryptographic checksum, but let's be
                    * very conservative here and just memcmp.


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