Description
CalculateChecksum
checks address validity incorrectly 1:
if ( IsLegalRange(pCommand->address, pCommand->address+pCommand->dataLength-1))
Compare with the equivalent check in ReadFlash
2:
if (IsLegalRange(pCommand->address, pCommand->address+pCommand->dataLength/2)
WriteFlash
also checks address validity in the same way as ReadFlash
3.
CalculateChecksum
's validity constraint is tighter than that of ReadFlash
and WriteFlash
. As a result, addresses close to the upper end of the program memory range are readable/writable, but not checksummable.
In practice, this does not affect us because the PSLab's firmware currently does not write anything to the affected addresses.
Footnotes
-
https://github.com/fossasia/pslab-bootloader/blob/5e1616dc1366fb7e08c73000c62aba77432c1327/src/mcc_generated_files/boot/boot_process.c#L445 ↩
-
https://github.com/fossasia/pslab-bootloader/blob/5e1616dc1366fb7e08c73000c62aba77432c1327/src/mcc_generated_files/boot/boot_process.c#L403 ↩
-
https://github.com/fossasia/pslab-bootloader/blob/5e1616dc1366fb7e08c73000c62aba77432c1327/src/mcc_generated_files/boot/boot_process.c#L354 ↩