From 1093ba9bbbfa2270109cf68cd1a679849c716d0d Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Mon, 13 Jul 2026 11:02:33 +0200 Subject: [PATCH] Abort saving content file if rehash blocks exist with undefined previous checksum --- cmdline/state.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmdline/state.c b/cmdline/state.c index 80706d8c..bc6b27c1 100644 --- a/cmdline/state.c +++ b/cmdline/state.c @@ -3909,6 +3909,13 @@ static void state_write_content(struct snapraid_state* state, uint32_t* out_crc) } } + if (info_has_rehash && state->prevhash == HASH_UNDEFINED) { + /* LCOV_EXCL_START */ + log_fatal(EINTERNAL, "Internal inconsistency: Rehash blocks found but previous checksum is missing!\n"); + os_abort(); + /* LCOV_EXCL_STOP */ + } + /* map disks */ mapping_idx = 0; for (i = state->maplist; i != 0; i = i->next) {