From ff95a85875ccfcfb87118b9424c33f41e29290ab Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Fri, 15 May 2026 01:02:22 +0300 Subject: [PATCH] Add bound check to je_crc32 --- src/blockstore/ondisk_formats.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blockstore/ondisk_formats.h b/src/blockstore/ondisk_formats.h index 071e9b8d..6faa950a 100644 --- a/src/blockstore/ondisk_formats.h +++ b/src/blockstore/ondisk_formats.h @@ -141,7 +141,7 @@ struct __attribute__((__packed__)) journal_entry inline uint32_t je_crc32(journal_entry *je) { // 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"