Skip to content

Commit 8e08162

Browse files
committed
segment: return error if cached identifier is not 8 bytes long
1 parent b25d7e4 commit 8e08162

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/crc/segment/segment.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ func readIdentifyHash(identifyHashPath string) (uint64, error) {
139139
return 0, err
140140
}
141141

142+
if length := len(cachedHashBytes); length != 8 {
143+
return 0, fmt.Errorf("Got %d bytes hash, expected 8", length)
144+
}
145+
142146
return binary.LittleEndian.Uint64(cachedHashBytes), nil
143147
}
144148

0 commit comments

Comments
 (0)