Add bound check to je_crc32

This commit is contained in:
Vitaliy Filippov
2026-05-18 01:17:56 +03:00
parent 98203568a8
commit ff95a85875
+1 -1
View File
@@ -141,7 +141,7 @@ struct __attribute__((__packed__)) journal_entry
inline uint32_t je_crc32(journal_entry *je) inline uint32_t je_crc32(journal_entry *je)
{ {
// 0x48674bc7 = crc32(4 zero bytes) // 0x48674bc7 = crc32(4 zero bytes)
return crc32c(0x48674bc7, ((uint8_t*)je)+4, je->size-4); return je->size < 4 ? 0 : crc32c(0x48674bc7, ((uint8_t*)je)+4, je->size-4);
} }
// "VITAstor" // "VITAstor"