fix(ledc): add error check for potential out-of-bounds read

This commit is contained in:
Chen Chen
2026-02-24 18:10:21 +08:00
parent a884e752a2
commit 32ee52d8a6
2 changed files with 2 additions and 1 deletions
@@ -475,7 +475,7 @@ esp_err_t ledc_set_fade_with_time(ledc_mode_t speed_mode, ledc_channel_t channel
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Intr flag error
* - ESP_ERR_NOT_FOUND Failed to find available interrupt source
* - ESP_ERR_INVALID_STATE Fade function already installed
* - ESP_ERR_INVALID_STATE Fade function already installed / LEDC not initialized
*/
esp_err_t ledc_fade_func_install(int intr_alloc_flags);
+1
View File
@@ -1578,6 +1578,7 @@ esp_err_t ledc_fade_func_install(int intr_alloc_flags)
break;
}
}
LEDC_CHECK(speed_mode < LEDC_SPEED_MODE_MAX, "LEDC not initialized, call ledc_timer_config first", ESP_ERR_INVALID_STATE);
//OR intr_alloc_flags with ESP_INTR_FLAG_IRAM because the fade isr is in IRAM
return esp_intr_alloc_intrstatus(