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

Bug report - maxByte calculation error in SPIFlash::writeStr line 1055 #243

Open
Corj84 opened this issue Sep 9, 2022 · 0 comments
Open
Assignees
Labels
possible bug Possibly a bug. Needs verification before moving to *bug* status.

Comments

@Corj84
Copy link

Corj84 commented Sep 9, 2022

Bug Report

With SPIFlash::writeStr

The formula in the line 1055 (SPIFlash.cpp) does not take into account the offset of the address by the value of the line size sizeof(_sz). As a result, an overflow may occur and an attempt to write to the beginning of the current page of memory may occur instead of continuing the write on the next page. This may cause a write error!

Current formula:

uint16_t maxBytes = SPI_PAGESIZE-(_addr % SPI_PAGESIZE);  // Force the first set of bytes to stay within the first page

Variant of the formula, taking into account the address offset:

  uint16_t maxBytes = SPI_PAGESIZE-(_currentAddress % SPI_PAGESIZE);  // Force the first set of bytes to stay within the first page
@Corj84 Corj84 added the possible bug Possibly a bug. Needs verification before moving to *bug* status. label Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible bug Possibly a bug. Needs verification before moving to *bug* status.
Projects
None yet
Development

No branches or pull requests

2 participants