From 9b1aaa277834d1ba14af19b1bf91ec9908e46bbb Mon Sep 17 00:00:00 2001 From: Laukik Hase Date: Mon, 23 Jun 2025 11:44:30 +0530 Subject: [PATCH] fix(esp_tee): Fix coverity issues from the `attestation` component - Also fix the incorrect marker set for TEE OTA tests --- .../components/attestation/esp_att_utils_part_info.c | 4 ++++ components/esp_tee/test_apps/tee_test_fw/pytest_esp_tee_ut.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/components/esp_tee/subproject/components/attestation/esp_att_utils_part_info.c b/components/esp_tee/subproject/components/attestation/esp_att_utils_part_info.c index 5fb346b108..46d8f8597e 100644 --- a/components/esp_tee/subproject/components/attestation/esp_att_utils_part_info.c +++ b/components/esp_tee/subproject/components/attestation/esp_att_utils_part_info.c @@ -272,6 +272,10 @@ static esp_err_t get_part_digest(const esp_partition_pos_t *pos, esp_att_part_di part_digest->type = ESP_ATT_DIGEST_TYPE_SHA256; size_t digest_len = digest_type_to_len(part_digest->type); + + if (metadata.image_len < digest_len) { + return ESP_ERR_INVALID_SIZE; + } size_t image_len = metadata.image_len - digest_len; uint8_t *digest = calloc(digest_len, sizeof(uint8_t)); diff --git a/components/esp_tee/test_apps/tee_test_fw/pytest_esp_tee_ut.py b/components/esp_tee/test_apps/tee_test_fw/pytest_esp_tee_ut.py index 958a9ff053..409c0bdfc3 100644 --- a/components/esp_tee/test_apps/tee_test_fw/pytest_esp_tee_ut.py +++ b/components/esp_tee/test_apps/tee_test_fw/pytest_esp_tee_ut.py @@ -21,7 +21,7 @@ CONFIG_DEFAULT = [ CONFIG_OTA = [ # 'config, target, skip_autoflash, markers', - ('ota', target, 'y', (pytest.mark.host_test,)) + ('ota', target, 'y', (pytest.mark.generic,)) for target in SUPPORTED_TARGETS ]