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 underflow in swap-scratch when trailer is large
When using swap-scratch, the last sector of a slot able to contain
firmware data might also contain part of the trailer (or the whole
trailer, if the latter is small enough). When the trailer is large, a
single sector it might not fit in a single sector and that last firmware
sector might therefore not be the last sector of the slot.
When that happens, and unless the trailer starts exactly at the
beginning of a sector, an underflow could occur when computing the
number of bytes that must be copied from the last firmware sector.
Indeed, when the trailer is large, its size can be larger than that
sector and, depending on the size of the sratch area, 'copy_sz' can at
worst equal to the size of this sector.
If this underflow occurs, 'copy_sz' would end up containing a very large
value, that would probably cause the upgrade to fail and could lead to a
corruption of a large part of the flash memory if no bound check is
performed in the flash driver.
Signed-off-by: Thomas Altenbach <[email protected]>
0 commit comments