diff --git a/internal/snapshot/snapshot_fuzz_test.go b/internal/snapshot/snapshot_fuzz_test.go index 3b167ffe..9ab2a7e6 100644 --- a/internal/snapshot/snapshot_fuzz_test.go +++ b/internal/snapshot/snapshot_fuzz_test.go @@ -71,7 +71,10 @@ func checkDescriptorDecode(t *testing.T, sector []byte, idx uint64) { if err != nil { t.Fatalf("decoding a re-encoded descriptor: %v", err) } + // Bytes only some formats use, such as the birth generation without + // FlagHasTargetBirth, re-encode as zero and change the checksum. + again.Checksum = desc.Checksum if *again != *desc { - t.Fatalf("descriptor changed after an encode/decode round trip") + t.Fatalf("descriptor changed after an encode/decode round trip: %+v != %+v", again, desc) } } diff --git a/internal/snapshot/testdata/fuzz/FuzzDecodeDescriptor/8ac4626f92ad713e b/internal/snapshot/testdata/fuzz/FuzzDecodeDescriptor/8ac4626f92ad713e new file mode 100644 index 00000000..cec162ce --- /dev/null +++ b/internal/snapshot/testdata/fuzz/FuzzDecodeDescriptor/8ac4626f92ad713e @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("0000000000000000000000000A000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") +byte('\x00')