Skip to content
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

Fix OOB flash write when DFU interrupted #2020

Merged
merged 1 commit into from
Feb 14, 2024
Merged

Conversation

mark9064
Copy link
Member

If a DFU is restarted, the write indices aren't reset causing the image to be written out of bounds. The CRC check prevents the faulty image from booting but LittleFS still gets nuked.

There are other issues with DFU if the central is acting maliciously, but this resolves a corruption encountered in normal usage. If a DFU fails for whatever reason (bad bluetooth signal, whatever), the user is likely to retry the update which will fail if they do not reboot first due to this issue.

If a DFU is restarted, the write indices aren't reset causing the image to be written out of bounds. The CRC check prevents the faulty image from booting but LittleFS still gets nuked.
Copy link

Build size and comparison to main:

Section Size Difference
text 373224B -16B
data 940B 0B
bss 63516B 0B

Copy link
Member

@FintasticMan FintasticMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@JF002 JF002 added this to the 1.15.0 milestone Feb 14, 2024
@JF002 JF002 merged commit 93d7da1 into InfiniTimeOrg:main Feb 14, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants