-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Most versions of OTAImageProcessorImpl::SetBlock are broken #13393
Comments
Testing the fix for this is currently blocked by #13429 |
…13778) * Implement the CancelImageUpdate() OTARequestor API * Restyled by clang-format * Add CancelImageUpdate() to OTARequestorInterface * Add the override modifier * Add UpdateCancelled() API to OTARequestorDriver * Restyled by clang-format * Fix a bug in SetBlock() where varied block size will kill the download Issue: #13393 Co-authored-by: Restyled.io <[email protected]>
Not fixed. Just fixed for Linux, still broken for Ameba, EFR32, qpg (this last fixed in #14388). |
Not sure how it got closed (did the CI close it because it was referenced in my PR?). If I did it, it certainly wasn't on purpose as at that time I was assigning it to QPG. |
Your PR said "fixes #issue-number", and github itself automatically closes issues when a PR that says that is merged. |
…roject-chip#13778) * Implement the CancelImageUpdate() OTARequestor API * Restyled by clang-format * Add CancelImageUpdate() to OTARequestorInterface * Add the override modifier * Add UpdateCancelled() API to OTARequestorDriver * Restyled by clang-format * Fix a bug in SetBlock() where varied block size will kill the download Issue: project-chip#13393 Co-authored-by: Restyled.io <[email protected]>
@bzbarsky-apple: sorry I don't fully follow. The following is the implementation in EFR32 (Ameba's is similar). Is something still broken here? This is the fix I applied back in December.
|
I am not sure why I said "EFR32"... Ameba was fixed a few days ago (after my comment). I just checked all the impls, and they look good now. |
Problem
The K32W, Linux, and EFR32 implementations of
OTAImageProcessorImpl::SetBlock
all have the same problem, due to being copy/pasted from each other. If the blocks coming in are different sizes (which is very much allowed in bdx), then any block that's larger than the smallest preceding block will fail.Specifically,
CopySpanToMutableSpan
, which is used in the function does the following:Step 3 is key. It means that
mBlock
will be the size of the smallest block seen so far.The implementation on ESP32 does not have this problem, though it will do too much releasing/allocating because it does not keep track of the actual available space in mBlock, just of the space used by the last block copied into it.
Proposed Solution
Ideally, stop having multiple copies of this (clearly hard to get right) code. Have one copy, that we make correct and everyone uses.
Failing that, at least copy/paste the non-buggy version.
The text was updated successfully, but these errors were encountered: