
#define MAX_SEGMENT_LENGTH 1048576 // 1 MB

static esp_err_t process_segment_data(intptr_t load_addr, uint32_t data_addr, uint32_t data_len, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum)
{
    if (data_len > MAX_SEGMENT_LENGTH) {
        return ESP_ERR_INVALID_SIZE;
    }
    // Rest of the function implementation
}
