Skip to content

Commit bdf7b62

Browse files
authored
fix: Correct flash boundary check for read/verify operations
The checks on read/verity used `>=` not `>` meaning last byte of flash could not be verified or read, resulting in `ESP_LOADER_ERROR_IMAGE_SIZE` error.
1 parent 5edd10d commit bdf7b62

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/esp_loader.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ static esp_loader_error_t flash_read_stub(uint8_t *dest, uint32_t address, uint3
609609
esp_loader_error_t esp_loader_flash_read(uint8_t *dest, uint32_t address, uint32_t length)
610610
{
611611
RETURN_ON_ERROR(init_flash_params());
612-
if (address + length >= s_target_flash_size) {
612+
if (address + length > s_target_flash_size) {
613613
return ESP_LOADER_ERROR_IMAGE_SIZE;
614614
}
615615

@@ -810,7 +810,7 @@ esp_loader_error_t esp_loader_flash_verify_known_md5(uint32_t address,
810810

811811
RETURN_ON_ERROR(init_flash_params());
812812

813-
if (address + size >= s_target_flash_size) {
813+
if (address + size > s_target_flash_size) {
814814
return ESP_LOADER_ERROR_IMAGE_SIZE;
815815
}
816816

0 commit comments

Comments
 (0)