You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
boot: bootutil: Fix invalid last sector computation for swap-scratch
At the beginning of a swap-scratch upgrade, the index of the last sector
in the primary slot that need to be swapped is computed using the
'find_last_sector_idx' routine. However, if the primary slot is composed
of larger sectors than the secondary slots, this routine could return a
wrong sector index for the primary slot. The index might even be outside
the primary slot, which would lead to (at best) a simple failure of the
upgrade and at worst a corruption of the flash memory bricking the
device.
This commit fixes the issue by ensuring 'find_last_sector_idx' always
returns a valid sector index for the primary slot.
Signed-off-by: Thomas Altenbach <[email protected]>
0 commit comments