Add protection for block position integer overflow

This commit is contained in:
Andrea Mazzoleni 2026-06-03 19:00:24 +02:00
parent c814b474be
commit cc99a22929
5 changed files with 25 additions and 17 deletions

View file

@ -1454,7 +1454,7 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
}
/* adjust the number of block to process */
if (blockcount != 0 && blockstart + blockcount < blockmax) {
if (blockcount != 0 && blockcount < blockmax - blockstart) {
blockmax = blockstart + blockcount;
}