From 843b19d72a93a7a7aaba413a1a7e47c0af56ed5b Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 23 Jul 2026 16:18:25 +1000 Subject: [PATCH] cpatch: fix trailing input hash Update the input file iteration to include the very last sliding window in the input file data hash. Signed-off-by: Jordan Yates --- src/infuse_iot/cpatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/infuse_iot/cpatch.py b/src/infuse_iot/cpatch.py index e032c5b..0fc1c15 100644 --- a/src/infuse_iot/cpatch.py +++ b/src/infuse_iot/cpatch.py @@ -506,7 +506,7 @@ def _naive_diff(cls, old: bytes, new: bytes, hash_len: int = 8): # Pre-hash original image pre_hash = {} prev_val = None - for offset in range(len(old) - hash_len): + for offset in range(len(old) - hash_len + 1): val = old[offset : offset + hash_len] if val == prev_val: continue