From 08d0514eb55c73615d3517ec7ff77b0565b87c34 Mon Sep 17 00:00:00 2001 From: "sonika.rathi" Date: Tue, 11 Aug 2026 14:17:43 +0200 Subject: [PATCH] fix(esp_partition): guard linux erase_range against zero erase_size --- components/esp_partition/partition_linux.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/esp_partition/partition_linux.c b/components/esp_partition/partition_linux.c index 4144ac9f9b5..00e85189a55 100644 --- a/components/esp_partition/partition_linux.c +++ b/components/esp_partition/partition_linux.c @@ -648,6 +648,9 @@ esp_err_t esp_partition_write_raw(const esp_partition_t *partition, size_t dst_o esp_err_t esp_partition_erase_range(const esp_partition_t *partition, size_t offset, size_t size) { assert(partition != NULL && s_spiflash_mem_file_buf != NULL); + if (partition->erase_size == 0) { + return ESP_ERR_INVALID_ARG; + } if (partition->readonly) { return ESP_ERR_NOT_ALLOWED;