Skip to content

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

@Corj84

Description

@Corj84

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

Metadata

Metadata

Assignees

Labels

possible bugPossibly a bug. Needs verification before moving to *bug* status.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions