mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
fix(esp_image_format): verify length of segment #0 for app description
This commit is contained in:
committed by
Konstantin Kondrashov
parent
e8c1dad0c1
commit
747facfa27
@@ -871,6 +871,10 @@ static esp_err_t verify_segment_header(int index, const esp_image_segment_header
|
||||
|
||||
/* ESP APP descriptor is present in the DROM segment #0 */
|
||||
if (index == 0 && !is_bootloader(metadata->start_addr)) {
|
||||
if (segment->data_len < sizeof(esp_app_desc_t)) {
|
||||
ESP_LOGE(TAG, "Segment %d: length 0x%"PRIx32" is too short for app description", index, segment->data_len);
|
||||
return ESP_ERR_IMAGE_INVALID;
|
||||
}
|
||||
uint32_t mmu_page_size = 0, magic_word = 0;
|
||||
const uint32_t mmu_page_size_offset = segment_data_offs + offsetof(esp_app_desc_t, mmu_page_size);
|
||||
CHECK_ERR(bootloader_flash_read(segment_data_offs, &magic_word, sizeof(uint32_t), true));
|
||||
|
||||
Reference in New Issue
Block a user