parallaxinc / PropLoader

Parallax Propeller loader supporting both serial and wifi downloads
MIT License
27 stars 13 forks source link

Bad image produces successful download #18

Closed PropGit closed 7 years ago

PropGit commented 7 years ago

A very mangled image is allowed to download, and worse, indicates it downloads successfully. Something is very wrong here.

PropGit will explore this further.

This image is what was tested:

00000000h: 00 B4 C4 04 6F 61 12 24 77 66 33 57 68 45 62 35
00000010h: 92 34 58 70 12 39 42 34 85 01 29 34 09 45 92 34
00000020h: 02 34 95 86 71 92 48 57 91 83 45 09 83 45 AD F4

and PropLoader displays this:

Loading 'PABWX-Blink#1-BadHeader.binary'
Loading second-stage loader
Load complete
Loading image.
Verifying RAM
Sending readyToLaunch packet
Sending launchNow packet
PropGit commented 7 years ago

UPDATE

dbetz: It looks to me as though [the loader is] just doing a checksum of what [PropLoader] sent [it] so even a bad image will create a good checksum. No one is comparing it with the checksum in the image header as far as I can tell. PropLoader computes the value it expects to receive from [the loader] but that computation is independent of the value in the .binary header.

PropGit: I think you're right, yes. I have a faint memory of saving space in the second stage loader by having it compute and report but not have special logic to test validity... it was designed to rely on the sender to verify that it's the correct checksum. That's partly because I built the original tool to verify the image before it even bothered transmitting it to the Propeller, thus it would have errored out before the second stage loader even got involved.

We'll have to enhance PropLoader to do a sanity check on the image.

PropGit commented 7 years ago

Please enhance PropLoader to perform a sanity check on the firmware image and throw an error if something is wrong, or use the verified checksum as the value to check against for the second-stage loader's checksum verification response.

PropGit commented 7 years ago

PropLoader v1.0-11 was updated to include some sanity checks and corresponding error messages. Some final issues exist, noted in Issue #22 , but this issue #18 is considered closed.