Datasets:
repo_name stringclasses 64
values | commit_hash stringlengths 40 40 | commit_message stringlengths 11 23.9k | file_path stringlengths 4 128 | function_name stringlengths 1 95 | vuln_category stringclasses 9
values | cve_ids listlengths 0 6 | vulnerable_code stringlengths 16 37.5k | fixed_code stringlengths 34 37.7k | commit_url stringlengths 74 100 | commit_date timestamp[s]date 1999-02-23 07:47:30 2026-10-07 19:06:48 | n_added_lines int64 0 214 | n_deleted_lines int64 0 200 | language stringclasses 2
values | repo_stars int64 0 19.2k | repo_license stringclasses 5
values | pair_hash stringlengths 64 64 | pr_number int64 56 121k ⌀ | pr_title stringlengths 8 148 ⌀ | pr_labels listlengths 0 13 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
espressif/esp-idf | 72cf05893c020459c9ff00156874fc3eb494507d | fix(tcp_transport): Fix out-of-bounds read on short WebSocket CLOSE | components\tcp_transport\transport_ws.c | esp_transport_ws_handle_control_frames | Buffer Overflow | [] | static int esp_transport_ws_handle_control_frames(esp_transport_handle_t t, char *buffer, int len, int timeout_ms, bool client_closed)
{
transport_ws_t *ws = esp_transport_get_context_data(t);
// If no new header reception in progress, or not a control frame
// just pass 0 -> no need to handle control fram... | static int esp_transport_ws_handle_control_frames(esp_transport_handle_t t, char *buffer, int len, int timeout_ms, bool client_closed)
{
transport_ws_t *ws = esp_transport_get_context_data(t);
// If no new header reception in progress, or not a control frame
// just pass 0 -> no need to handle control fram... | https://github.com/espressif/esp-idf/commit/72cf05893c020459c9ff00156874fc3eb494507d | 2026-09-22T10:48:05 | 6 | 3 | C | 19,172 | Apache-2.0 | 44d8b98c86c04d7e0cb585f13b90aa3ddcb365a850d7359c53d3cfd8a25b9c2f | null | null | [] |
espressif/esp-idf | 23bd88f3924fbf1020d0133fd89505549d7739da | fix(protocomm): guard NULL pc->sec in protocomm_get_sec_version
protocomm_get_sec_version() validated pc, sec_ver and sec_patch_ver but
dereferenced pc->sec unconditionally. pc->sec remains NULL until
protocomm_set_security() runs, so calling this API before security is
configured dereferences a NULL pointer and crash... | components\protocomm\src\common\protocomm.c | protocomm_get_sec_version | Null Pointer Dereference | [] | esp_err_t protocomm_get_sec_version(protocomm_t *pc, int *sec_ver, uint8_t *sec_patch_ver)
{
if (pc == NULL || sec_ver == NULL || sec_patch_ver == NULL) {
return ESP_ERR_INVALID_ARG;
}
*sec_ver = pc->sec->ver;
*sec_patch_ver = pc->sec->patch_ver;
return ESP_OK;
} | esp_err_t protocomm_get_sec_version(protocomm_t *pc, int *sec_ver, uint8_t *sec_patch_ver)
{
if (pc == NULL || sec_ver == NULL || sec_patch_ver == NULL) {
return ESP_ERR_INVALID_ARG;
}
if (pc->sec == NULL) {
return ESP_ERR_INVALID_STATE;
}
*sec_ver = pc->sec->ver;
*sec_patch_ve... | https://github.com/espressif/esp-idf/commit/23bd88f3924fbf1020d0133fd89505549d7739da | 2026-09-21T06:11:57 | 4 | 0 | C | 19,172 | Apache-2.0 | c6cd974ecdb347fc259f03699d9464ac16885303f685db6806ce4b0b46331a21 | null | null | [] |
espressif/esp-idf | 046e69d92538a3c8ef89acf47cab4b18b99314f8 | fix(ble_mesh): index last_param by inst_type, not controller inst_id
last_param[] is sized by BLE_MESH_ADV_INST_TYPES_NUM (the number of mesh
advertising instance types) but was indexed by inst_id, the controller
advertising instance id (Kconfig range 0-3). With multi-adv disabled the
type count is 1, so any non-zero ... | components\bt\esp_ble_mesh\core\bluedroid_host\adapter.c | bt_le_ext_adv_start | Buffer Overflow | [] | int bt_le_ext_adv_start(const uint8_t inst_id,
const struct bt_mesh_adv_param *param,
const struct bt_mesh_adv_data *ad, size_t ad_len,
const struct bt_mesh_adv_data *sd, size_t sd_len)
{
tBTA_DM_BLE_GAP_EXT_ADV_PARAMS ext_adv_params = {0};
... | int bt_le_ext_adv_start(const uint8_t inst_id,
const struct bt_mesh_adv_param *param,
const struct bt_mesh_adv_data *ad, size_t ad_len,
const struct bt_mesh_adv_data *sd, size_t sd_len)
{
tBTA_DM_BLE_GAP_EXT_ADV_PARAMS ext_adv_params = {0};
... | https://github.com/espressif/esp-idf/commit/046e69d92538a3c8ef89acf47cab4b18b99314f8 | 2026-09-11T04:05:21 | 11 | 4 | C | 19,172 | Apache-2.0 | b4c731b2313ba40becac02062ad0b152ddf20570af1d29177170cb958775d4d8 | null | null | [] |
espressif/esp-idf | 046e69d92538a3c8ef89acf47cab4b18b99314f8 | fix(ble_mesh): index last_param by inst_type, not controller inst_id
last_param[] is sized by BLE_MESH_ADV_INST_TYPES_NUM (the number of mesh
advertising instance types) but was indexed by inst_id, the controller
advertising instance id (Kconfig range 0-3). With multi-adv disabled the
type count is 1, so any non-zero ... | components\bt\esp_ble_mesh\core\nimble_host\adapter.c | bt_le_ext_adv_start | Buffer Overflow | [] | int bt_le_ext_adv_start(const uint8_t inst_id,
const struct bt_mesh_adv_param *param,
const struct bt_mesh_adv_data *ad, size_t ad_len,
const struct bt_mesh_adv_data *sd, size_t sd_len)
{
struct ble_gap_ext_adv_params adv_params = {0};
stru... | int bt_le_ext_adv_start(const uint8_t inst_id,
const struct bt_mesh_adv_param *param,
const struct bt_mesh_adv_data *ad, size_t ad_len,
const struct bt_mesh_adv_data *sd, size_t sd_len)
{
struct ble_gap_ext_adv_params adv_params = {0};
stru... | https://github.com/espressif/esp-idf/commit/046e69d92538a3c8ef89acf47cab4b18b99314f8 | 2026-09-11T04:05:21 | 11 | 4 | C | 19,172 | Apache-2.0 | 9e2610ed00e0a53a9480870f8f4d18947fbbcc2d7fb0d9aca19036e0fb9d167e | null | null | [] |
espressif/esp-idf | 6f6e2aa93c14abf4e43f0ea6dc13a451ae765017 | fix(mbedtls): Fix mbedtls testapps false memory leaks by lazy mutex creation | components\mbedtls\test_apps\persistent_storage_format\main\app_main.c | setUp | General Vulnerability | [] | void setUp(void)
{
test_utils_record_free_mem();
test_utils_set_leak_level(CONFIG_UNITY_CRITICAL_LEAK_LEVEL_GENERAL,
ESP_LEAK_TYPE_CRITICAL, ESP_COMP_LEAK_GENERAL);
test_utils_set_leak_level(CONFIG_UNITY_WARN_LEAK_LEVEL_GENERAL,
ESP_LEAK_TYPE_WARNI... | void setUp(void)
{
prime_psa_its(ESP_PERSISTENT_FIXTURE_DS_KEY_ID);
prime_psa_its(ESP_PERSISTENT_FIXTURE_HMAC_KEY_ID);
prime_psa_its(ESP_PERSISTENT_FIXTURE_ECDSA_KEY_ID);
test_utils_record_free_mem();
test_utils_set_leak_level(CONFIG_UNITY_CRITICAL_LEAK_LEVEL_GENERAL,
... | https://github.com/espressif/esp-idf/commit/6f6e2aa93c14abf4e43f0ea6dc13a451ae765017 | 2026-09-08T08:33:50 | 4 | 0 | C | 19,172 | Apache-2.0 | 43f40ca03cab5f0360ecc73e4544d56678283bc55ee9b2fc275732a47b2ebc6c | null | null | [] |
espressif/esp-idf | ed7153ef41bba1d01b1fb437a40ff1bbefdbe734 | fix(mbedtls): validate cert header extent before reading it in bundle check
esp_crt_check_bundle() read the 4-byte certificate header (name_len,
key_len) via esp_crt_get_len() after only checking that the cert's
start offset lies inside the bundle, so a crafted bundle whose first
or last certificate starts within the ... | components\mbedtls\esp_crt_bundle\esp_crt_bundle.c | esp_crt_check_bundle | Buffer Overflow | [] | static bool esp_crt_check_bundle(const uint8_t* const x509_bundle, const size_t bundle_size)
{
if (unlikely(x509_bundle == NULL || bundle_size <= (sizeof(uint32_t) + CRT_HEADER_SIZE))) {
// Bundle is too small for even one offset and one certificate
return false;
}
// The bundle base may be... | static bool esp_crt_check_bundle(const uint8_t* const x509_bundle, const size_t bundle_size)
{
if (unlikely(x509_bundle == NULL || bundle_size <= (sizeof(uint32_t) + CRT_HEADER_SIZE))) {
// Bundle is too small for even one offset and one certificate
return false;
}
// The bundle base may be... | https://github.com/espressif/esp-idf/commit/ed7153ef41bba1d01b1fb437a40ff1bbefdbe734 | 2026-08-31T05:31:36 | 4 | 1 | C | 19,172 | Apache-2.0 | 86b8122f2a1a58413bf3ae5623e17265c2fe8d676ea4f5474b6b3bb571574785 | null | null | [] |
espressif/esp-idf | a7ac00b812707d8ce683d2fc23b2f19353c08a3e | fix(jpeg): validate encoder buffer sizes before header/DMA access
Bound JPEG header emission by outbuf capacity and reject undersized
input buffers before programming TX DMA to avoid heap corruption and
out-of-bounds DMA reads. | components\esp_driver_jpeg\jpeg_emit_marker.c | emit_dqt_marker | Buffer Overflow | [] | esp_err_t emit_dqt_marker(jpeg_enc_header_info_t *header_info)
{
compute_quant_table(header_info->m_quantization_tables[0], luminance_quantization_table, header_info->quality);
compute_quant_table(header_info->m_quantization_tables[1], chrominance_quantization_table, header_info->quality);
for (int i = 0; i... | esp_err_t emit_dqt_marker(jpeg_enc_header_info_t *header_info)
{
compute_quant_table(header_info->m_quantization_tables[0], luminance_quantization_table, header_info->quality);
compute_quant_table(header_info->m_quantization_tables[1], chrominance_quantization_table, header_info->quality);
for (int i = 0; i... | https://github.com/espressif/esp-idf/commit/a7ac00b812707d8ce683d2fc23b2f19353c08a3e | 2026-08-25T08:29:16 | 1 | 1 | C | 19,172 | Apache-2.0 | 88709b4dbbc6d380cd373b0026a87b736a9ea31e9f8e57cc1104d9dea88f07e3 | null | null | [] |
espressif/esp-idf | a7ac00b812707d8ce683d2fc23b2f19353c08a3e | fix(jpeg): validate encoder buffer sizes before header/DMA access
Bound JPEG header emission by outbuf capacity and reject undersized
input buffers before programming TX DMA to avoid heap corruption and
out-of-bounds DMA reads. | components\esp_driver_jpeg\jpeg_emit_marker.c | emit_soi_marker | Buffer Overflow | [] | esp_err_t emit_soi_marker(jpeg_enc_header_info_t *header_info)
{
emit_marker(header_info, JPEG_M_SOI & 0xff);
return ESP_OK;
} | esp_err_t emit_soi_marker(jpeg_enc_header_info_t *header_info)
{
emit_marker(header_info, JPEG_M_SOI & 0xff);
return emit_check(header_info);
} | https://github.com/espressif/esp-idf/commit/a7ac00b812707d8ce683d2fc23b2f19353c08a3e | 2026-08-25T08:29:16 | 1 | 1 | C | 19,172 | Apache-2.0 | 81cdde5ecad815db7f8d577029133bcbd3064c73514cf2776cf688eb4443ec8e | null | null | [] |
espressif/esp-idf | a7ac00b812707d8ce683d2fc23b2f19353c08a3e | fix(jpeg): validate encoder buffer sizes before header/DMA access
Bound JPEG header emission by outbuf capacity and reject undersized
input buffers before programming TX DMA to avoid heap corruption and
out-of-bounds DMA reads. | components\esp_driver_jpeg\jpeg_emit_marker.c | emit_com_marker | Buffer Overflow | [] | esp_err_t emit_com_marker(jpeg_enc_header_info_t *header_info)
{
// Calculate how many bytes should be compensate to make it byte aligned.
size_t cache_align = 0;
esp_cache_get_alignment(MALLOC_CAP_SPIRAM, &cache_align);
// compensate_size = aligned_size - SOS marker size(2 * header_info->num_components... | esp_err_t emit_com_marker(jpeg_enc_header_info_t *header_info)
{
// Calculate how many bytes should be compensate to make it byte aligned.
size_t cache_align = 0;
esp_cache_get_alignment(MALLOC_CAP_SPIRAM, &cache_align);
// compensate_size = aligned_size - SOS marker size(2 * header_info->num_components... | https://github.com/espressif/esp-idf/commit/a7ac00b812707d8ce683d2fc23b2f19353c08a3e | 2026-08-25T08:29:16 | 1 | 1 | C | 19,172 | Apache-2.0 | b8da4675ba8cd3a2c5729ab43025118a4aa921af52c899cd0f1d7ce14fd32df2 | null | null | [] |
espressif/esp-idf | a7ac00b812707d8ce683d2fc23b2f19353c08a3e | fix(jpeg): validate encoder buffer sizes before header/DMA access
Bound JPEG header emission by outbuf capacity and reject undersized
input buffers before programming TX DMA to avoid heap corruption and
out-of-bounds DMA reads. | components\esp_driver_jpeg\jpeg_emit_marker.c | emit_sof_marker | Buffer Overflow | [] | esp_err_t emit_sof_marker(jpeg_enc_header_info_t *header_info)
{
uint8_t comp_h_samp[3] = {0};
uint8_t comp_v_samp[3] = {0};
switch (header_info->sub_sample) {
case JPEG_DOWN_SAMPLING_YUV444: {
comp_h_samp[0] = 1;
comp_v_samp[0] = 1;
comp_h_samp[1] = 1;
comp_v_samp[1] = 1... | esp_err_t emit_sof_marker(jpeg_enc_header_info_t *header_info)
{
uint8_t comp_h_samp[3] = {0};
uint8_t comp_v_samp[3] = {0};
switch (header_info->sub_sample) {
case JPEG_DOWN_SAMPLING_YUV444: {
comp_h_samp[0] = 1;
comp_v_samp[0] = 1;
comp_h_samp[1] = 1;
comp_v_samp[1] = 1... | https://github.com/espressif/esp-idf/commit/a7ac00b812707d8ce683d2fc23b2f19353c08a3e | 2026-08-25T08:29:16 | 1 | 1 | C | 19,172 | Apache-2.0 | 8db3a95c0c8322b9656d34f88502793c59b7d1c2cca20f51d404a11d1ba21676 | null | null | [] |
espressif/esp-idf | a7ac00b812707d8ce683d2fc23b2f19353c08a3e | fix(jpeg): validate encoder buffer sizes before header/DMA access
Bound JPEG header emission by outbuf capacity and reject undersized
input buffers before programming TX DMA to avoid heap corruption and
out-of-bounds DMA reads. | components\esp_driver_jpeg\jpeg_emit_marker.c | emit_app0_marker | Buffer Overflow | [] | esp_err_t emit_app0_marker(jpeg_enc_header_info_t *header_info)
{
emit_marker(header_info, JPEG_M_APP0 & 0xff);
emit_word(header_info, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1);
// 0x4A46494600 for JIF0
emit_byte(header_info, 0x4A);
emit_byte(header_info, 0x46);
emit_byte(header_info, 0x49);
emit_b... | esp_err_t emit_app0_marker(jpeg_enc_header_info_t *header_info)
{
emit_marker(header_info, JPEG_M_APP0 & 0xff);
emit_word(header_info, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1);
// 0x4A46494600 for JIF0
emit_byte(header_info, 0x4A);
emit_byte(header_info, 0x46);
emit_byte(header_info, 0x49);
emit_b... | https://github.com/espressif/esp-idf/commit/a7ac00b812707d8ce683d2fc23b2f19353c08a3e | 2026-08-25T08:29:16 | 1 | 1 | C | 19,172 | Apache-2.0 | 7d01aba60a94cbf4e3238850653c7f8ddf8dad66316223f469ded950f9d3ab6b | null | null | [] |
espressif/esp-idf | a7ac00b812707d8ce683d2fc23b2f19353c08a3e | fix(jpeg): validate encoder buffer sizes before header/DMA access
Bound JPEG header emission by outbuf capacity and reject undersized
input buffers before programming TX DMA to avoid heap corruption and
out-of-bounds DMA reads. | components\esp_driver_jpeg\jpeg_emit_marker.c | emit_sos_marker | Buffer Overflow | [] | esp_err_t emit_sos_marker(jpeg_enc_header_info_t *header_info)
{
emit_marker(header_info, JPEG_M_SOS & 0xff);
emit_word(header_info, 2 * header_info->num_components + 2 + 1 + 3);
emit_byte(header_info, header_info->num_components);
for (int i = 0; i < header_info->num_components; i++) {
emit_by... | esp_err_t emit_sos_marker(jpeg_enc_header_info_t *header_info)
{
emit_marker(header_info, JPEG_M_SOS & 0xff);
emit_word(header_info, 2 * header_info->num_components + 2 + 1 + 3);
emit_byte(header_info, header_info->num_components);
for (int i = 0; i < header_info->num_components; i++) {
emit_by... | https://github.com/espressif/esp-idf/commit/a7ac00b812707d8ce683d2fc23b2f19353c08a3e | 2026-08-25T08:29:16 | 1 | 1 | C | 19,172 | Apache-2.0 | e7de52606d8c3804064fdb55c6e3b558faa217c8e1d094885519c5c2bd8cba7c | null | null | [] |
espressif/esp-idf | a7ac00b812707d8ce683d2fc23b2f19353c08a3e | fix(jpeg): validate encoder buffer sizes before header/DMA access
Bound JPEG header emission by outbuf capacity and reject undersized
input buffers before programming TX DMA to avoid heap corruption and
out-of-bounds DMA reads. | components\esp_driver_jpeg\jpeg_emit_marker.c | emit_byte | Buffer Overflow | [] | static void emit_byte(jpeg_enc_header_info_t *header_info, uint8_t i)
{
header_info->header_buf[header_info->header_len] = i;
header_info->header_len = header_info->header_len + 1;
} | static void emit_byte(jpeg_enc_header_info_t *header_info, uint8_t i)
{
if (header_info->header_len >= header_info->header_buf_size) {
header_info->header_buf_overflow = true;
return;
}
header_info->header_buf[header_info->header_len] = i;
header_info->header_len = header_info->header_le... | https://github.com/espressif/esp-idf/commit/a7ac00b812707d8ce683d2fc23b2f19353c08a3e | 2026-08-25T08:29:16 | 4 | 0 | C | 19,172 | Apache-2.0 | b4cd17cda3ab4766522afd04a4ea9c94e2e68340630aae6d7ff1e07631cdd98e | null | null | [] |
espressif/esp-idf | a7ac00b812707d8ce683d2fc23b2f19353c08a3e | fix(jpeg): validate encoder buffer sizes before header/DMA access
Bound JPEG header emission by outbuf capacity and reject undersized
input buffers before programming TX DMA to avoid heap corruption and
out-of-bounds DMA reads. | components\esp_driver_jpeg\jpeg_emit_marker.c | emit_dht_marker | Buffer Overflow | [] | esp_err_t emit_dht_marker(jpeg_enc_header_info_t *header_info)
{
uint8_t m_huff_bits[2][2][JPEG_HUFFMAN_BITS_LEN_TABLE_LEN] = {0};
uint8_t m_huff_val[2][2][JPEG_HUFFMAN_AC_VALUE_TABLE_LEN] = {0};
memcpy(m_huff_bits[0][0], luminance_dc_coefficients, JPEG_HUFFMAN_DC_VALUE_TABLE_LEN);
memcpy(m_huff_val[0][... | esp_err_t emit_dht_marker(jpeg_enc_header_info_t *header_info)
{
uint8_t m_huff_bits[2][2][JPEG_HUFFMAN_BITS_LEN_TABLE_LEN] = {0};
uint8_t m_huff_val[2][2][JPEG_HUFFMAN_AC_VALUE_TABLE_LEN] = {0};
memcpy(m_huff_bits[0][0], luminance_dc_coefficients, JPEG_HUFFMAN_DC_VALUE_TABLE_LEN);
memcpy(m_huff_val[0][... | https://github.com/espressif/esp-idf/commit/a7ac00b812707d8ce683d2fc23b2f19353c08a3e | 2026-08-25T08:29:16 | 1 | 1 | C | 19,172 | Apache-2.0 | 79aead60331d1f8b8727a502a95b818d50f0fe5352397d127a06524b0437b056 | null | null | [] |
espressif/esp-idf | a7ac00b812707d8ce683d2fc23b2f19353c08a3e | fix(jpeg): validate encoder buffer sizes before header/DMA access
Bound JPEG header emission by outbuf capacity and reject undersized
input buffers before programming TX DMA to avoid heap corruption and
out-of-bounds DMA reads. | components\esp_driver_jpeg\jpeg_encode.c | jpeg_encoder_process | Buffer Overflow | [] | esp_err_t jpeg_encoder_process(jpeg_encoder_handle_t encoder_engine, const jpeg_encode_cfg_t *encode_cfg, const uint8_t *encode_inbuf, uint32_t inbuf_size, uint8_t *bit_stream, uint32_t outbuf_size, uint32_t *out_size)
{
ESP_RETURN_ON_FALSE(encoder_engine, ESP_ERR_INVALID_ARG, TAG, "jpeg encode handle is null");
... | esp_err_t jpeg_encoder_process(jpeg_encoder_handle_t encoder_engine, const jpeg_encode_cfg_t *encode_cfg, const uint8_t *encode_inbuf, uint32_t inbuf_size, uint8_t *bit_stream, uint32_t outbuf_size, uint32_t *out_size)
{
ESP_RETURN_ON_FALSE(encoder_engine, ESP_ERR_INVALID_ARG, TAG, "jpeg encode handle is null");
... | https://github.com/espressif/esp-idf/commit/a7ac00b812707d8ce683d2fc23b2f19353c08a3e | 2026-08-25T08:29:16 | 6 | 0 | C | 19,172 | Apache-2.0 | af927eb11875cd11192d241e61d87d689e9b0291e1655efcf83ab6839f49198a | null | null | [] |
espressif/esp-idf | a7ac00b812707d8ce683d2fc23b2f19353c08a3e | fix(jpeg): validate encoder buffer sizes before header/DMA access
Bound JPEG header emission by outbuf capacity and reject undersized
input buffers before programming TX DMA to avoid heap corruption and
out-of-bounds DMA reads. | components\esp_driver_jpeg\jpeg_encode.c | jpeg_new_encoder_engine | Buffer Overflow | [] | esp_err_t jpeg_new_encoder_engine(const jpeg_encode_engine_cfg_t *enc_eng_cfg, jpeg_encoder_handle_t *ret_encoder)
{
#if CONFIG_JPEG_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
esp_err_t ret = ESP_OK;
jpeg_encoder_handle_t encoder_engine = NULL;
ESP_RETURN_ON_FALSE(enc_eng_cfg, ESP_ER... | esp_err_t jpeg_new_encoder_engine(const jpeg_encode_engine_cfg_t *enc_eng_cfg, jpeg_encoder_handle_t *ret_encoder)
{
#if CONFIG_JPEG_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
esp_err_t ret = ESP_OK;
jpeg_encoder_handle_t encoder_engine = NULL;
ESP_RETURN_ON_FALSE(enc_eng_cfg, ESP_ER... | https://github.com/espressif/esp-idf/commit/a7ac00b812707d8ce683d2fc23b2f19353c08a3e | 2026-08-25T08:29:16 | 1 | 1 | C | 19,172 | Apache-2.0 | 60a614e2debdebe90fa363434f70266b668f6c3181d9e044e3a6f6075d9ea68f | null | null | [] |
espressif/esp-idf | a7ac00b812707d8ce683d2fc23b2f19353c08a3e | fix(jpeg): validate encoder buffer sizes before header/DMA access
Bound JPEG header emission by outbuf capacity and reject undersized
input buffers before programming TX DMA to avoid heap corruption and
out-of-bounds DMA reads. | components\esp_driver_jpeg\jpeg_encode.c | s_jpeg_set_header_info | Buffer Overflow | [] | static esp_err_t s_jpeg_set_header_info(jpeg_encoder_handle_t encoder_engine)
{
encoder_engine->header_info->header_len = 0;
ESP_RETURN_ON_ERROR(emit_soi_marker(encoder_engine->header_info), TAG, "marker emit failed");
ESP_RETURN_ON_ERROR(emit_app0_marker(encoder_engine->header_info), TAG, "marker emit fail... | static esp_err_t s_jpeg_set_header_info(jpeg_encoder_handle_t encoder_engine)
{
encoder_engine->header_info->header_len = 0;
encoder_engine->header_info->header_buf_overflow = false;
ESP_RETURN_ON_ERROR(emit_soi_marker(encoder_engine->header_info), TAG, "marker emit failed");
ESP_RETURN_ON_ERROR(emit_ap... | https://github.com/espressif/esp-idf/commit/a7ac00b812707d8ce683d2fc23b2f19353c08a3e | 2026-08-25T08:29:16 | 1 | 0 | C | 19,172 | Apache-2.0 | c71d34c955e5325ed12dbfe2c2221552997ea3067386e55595b83488467f8e76 | null | null | [] |
espressif/esp-idf | a7ac00b812707d8ce683d2fc23b2f19353c08a3e | fix(jpeg): validate encoder buffer sizes before header/DMA access
Bound JPEG header emission by outbuf capacity and reject undersized
input buffers before programming TX DMA to avoid heap corruption and
out-of-bounds DMA reads. | components\esp_driver_jpeg\test_apps\jpeg_test_apps\main\test_jpeg_encode.c | TEST_CASE | Buffer Overflow | [] | TEST_CASE("jpeg initialize twice test", "[jpeg]")
{
jpeg_encoder_handle_t encoder_handle = NULL;
jpeg_encode_engine_cfg_t encode_eng_cfg = {
.intr_priority = 0,
.timeout_ms = 40,
};
TEST_ESP_OK(jpeg_new_encoder_engine(&encode_eng_cfg, &encoder_handle));
assert(encoder_handle != NUL... | TEST_CASE("JPEG encode rejects undersized input/output buffers", "[jpeg]")
{
jpeg_encoder_handle_t jpeg_handle = NULL;
jpeg_encode_engine_cfg_t encode_eng_cfg = {
.timeout_ms = 40,
};
jpeg_encode_cfg_t enc_config = {
.src_type = JPEG_ENCODE_IN_FORMAT_RGB888,
.sub_sample = JPEG_DO... | https://github.com/espressif/esp-idf/commit/a7ac00b812707d8ce683d2fc23b2f19353c08a3e | 2026-08-25T08:29:16 | 56 | 0 | C | 19,172 | Apache-2.0 | c6061f6aeecdb9a2c1a556dca8345d74384ba7d1da91f0662f1aabcfd6c8653d | null | null | [] |
espressif/esp-idf | f864615d7d91ed2360c7093d15ff3fcfeb6c94d8 | fix(ble/bluedroid): harden LE bond handling across encryption
Keep the existing bond until the new pairing is encrypted, and on encryption
failure drop the link instead of clearing keys. Recovering from a peer that
really deleted the bond is opt-in through BT_BLE_SMP_UNBOND_ON_KEY_MISSING.
Closes BLERP (NDSS 2026) V5... | components\bt\host\bluedroid\stack\btm\btm_sec.c | btm_sec_encrypt_change | General Vulnerability | [] | void btm_sec_encrypt_change (UINT16 handle, UINT8 status, UINT8 encr_enable)
{
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle);
#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
tACL_CONN *p_acl = NULL;
#endif
BTM_TRACE_EVENT ("Security Manager: encrypt_change status:%d State:%d, encr_en... | void btm_sec_encrypt_change (UINT16 handle, UINT8 status, UINT8 encr_enable)
{
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle);
#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
tACL_CONN *p_acl = NULL;
#endif
BTM_TRACE_EVENT ("Security Manager: encrypt_change status:%d State:%d, encr_en... | https://github.com/espressif/esp-idf/commit/f864615d7d91ed2360c7093d15ff3fcfeb6c94d8 | 2026-08-21T11:17:48 | 28 | 4 | C | 19,172 | Apache-2.0 | fee82394016abb2ba269df7ad1ce9fddbfca0315eaf99437ca9045656475f7da | null | null | [] |
espressif/esp-idf | f864615d7d91ed2360c7093d15ff3fcfeb6c94d8 | fix(ble/bluedroid): harden LE bond handling across encryption
Keep the existing bond until the new pairing is encrypted, and on encryption
failure drop the link instead of clearing keys. Recovering from a peer that
really deleted the bond is opt-in through BT_BLE_SMP_UNBOND_ON_KEY_MISSING.
Closes BLERP (NDSS 2026) V5... | components\bt\host\bluedroid\stack\smp\smp_act.c | smp_proc_pair_cmd | General Vulnerability | [] | void smp_proc_pair_cmd(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UINT8 *p = (UINT8 *)p_data;
UINT8 reason = SMP_ENC_KEY_SIZE;
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (p_cb->pairing_bda);
SMP_TRACE_DEBUG("%s", __func__);
/* erase all keys if it is slave proc pairing req*/
if (p_dev_rec && (... | void smp_proc_pair_cmd(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UINT8 *p = (UINT8 *)p_data;
UINT8 reason = SMP_ENC_KEY_SIZE;
SMP_TRACE_DEBUG("%s", __func__);
/* Any existing bond is replaced only once the new pairing is authenticated, see
smp_check_auth_req(). An unauthenticated Pairing Requ... | https://github.com/espressif/esp-idf/commit/f864615d7d91ed2360c7093d15ff3fcfeb6c94d8 | 2026-08-21T11:17:48 | 4 | 5 | C | 19,172 | Apache-2.0 | 1ed7685d5f7d58113aeeb8d1af5e331a4b5c0a98b0a4720bbd6947d40aeab1fe | null | null | [] |
espressif/esp-idf | f864615d7d91ed2360c7093d15ff3fcfeb6c94d8 | fix(ble/bluedroid): harden LE bond handling across encryption
Keep the existing bond until the new pairing is encrypted, and on encryption
failure drop the link instead of clearing keys. Recovering from a peer that
really deleted the bond is opt-in through BT_BLE_SMP_UNBOND_ON_KEY_MISSING.
Closes BLERP (NDSS 2026) V5... | components\bt\host\bluedroid\stack\smp\smp_act.c | smp_send_pair_req | General Vulnerability | [] | void smp_send_pair_req(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
#if (BLE_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (p_cb->pairing_bda);
/* erase all keys when master sends pairing req*/
if (p_dev_rec) {
btm_sec_clear_ble_keys(p_dev_rec);
}
... | void smp_send_pair_req(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
/* Any existing bond is replaced only once the new pairing is authenticated,
see smp_check_auth_req(). */
/* do not manipulate the key, let app decide,
leave out to BTM to mandate key distribution... | https://github.com/espressif/esp-idf/commit/f864615d7d91ed2360c7093d15ff3fcfeb6c94d8 | 2026-08-21T11:17:48 | 3 | 7 | C | 19,172 | Apache-2.0 | c80e5de2b7005d323e0cccc07508f63434c22f017762a7a03e19d1ef57734fc1 | null | null | [] |
espressif/esp-idf | f864615d7d91ed2360c7093d15ff3fcfeb6c94d8 | fix(ble/bluedroid): harden LE bond handling across encryption
Keep the existing bond until the new pairing is encrypted, and on encryption
failure drop the link instead of clearing keys. Recovering from a peer that
really deleted the bond is opt-in through BT_BLE_SMP_UNBOND_ON_KEY_MISSING.
Closes BLERP (NDSS 2026) V5... | components\bt\host\bluedroid\stack\smp\smp_act.c | smp_check_auth_req | General Vulnerability | [] | void smp_check_auth_req(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UINT8 enc_enable = *(UINT8 *)p_data;
UINT8 reason = enc_enable ? SMP_SUCCESS : SMP_ENC_FAIL;
SMP_TRACE_DEBUG("%s rcvs enc_enable=%d i_keys=0x%x r_keys=0x%x "
"(i-initiator r-responder)\n",
__func__, enc_... | void smp_check_auth_req(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UINT8 enc_enable = *(UINT8 *)p_data;
UINT8 reason = enc_enable ? SMP_SUCCESS : SMP_ENC_FAIL;
SMP_TRACE_DEBUG("%s rcvs enc_enable=%d i_keys=0x%x r_keys=0x%x "
"(i-initiator r-responder)\n",
__func__, enc_... | https://github.com/espressif/esp-idf/commit/f864615d7d91ed2360c7093d15ff3fcfeb6c94d8 | 2026-08-21T11:17:48 | 16 | 0 | C | 19,172 | Apache-2.0 | 7d27287eb80c739354ffe1a5014782424bd0fe183b5bdbf89677dce6358f9c75 | null | null | [] |
espressif/esp-idf | babdd168c1a599cd2a271c2a5392002fd9c002e0 | SAE: Fix crash due to NULL pointer dereference in H2E parsing
In H2E (Hash-to-Element) mode, sae_parse_commit() parses the optional
Anti-Clogging Token Container by calling sae_parse_token_container().
However, callers of sae_parse_commit() that do not require retrieving
the anti-clogging token (such as PASN initiato... | components\wpa_supplicant\src\common\sae.c | sae_parse_token_container | Null Pointer Dereference | [] | static void sae_parse_token_container(struct sae_data *sae,
const u8 *pos, const u8 *end,
const u8 **token, size_t *token_len)
{
wpa_hexdump(MSG_DEBUG, "SAE: Possible elements at the end of the frame",
pos, end - pos);
if (!sae_is_token_container_elem(pos,... | static void sae_parse_token_container(struct sae_data *sae,
const u8 *pos, const u8 *end,
const u8 **token, size_t *token_len)
{
wpa_hexdump(MSG_DEBUG, "SAE: Possible elements at the end of the frame",
pos, end - pos);
if (!sae_is_token_container_elem(pos,... | https://github.com/espressif/esp-idf/commit/babdd168c1a599cd2a271c2a5392002fd9c002e0 | 2026-08-13T05:32:38 | 5 | 3 | C | 19,172 | Apache-2.0 | 6a025a9ab06e87dfcfe0b620e5dd30c3ecd4e07c4665b7f6a1d33b56c4ede98a | null | null | [] |
espressif/esp-idf | d9ba2da026b2c5ae62f17c2fdfdcc724c2abbbf4 | fix(wifi): Prevent double free in owe failure path | components\wpa_supplicant\src\rsn_supp\wpa.c | owe_process_assoc_resp | Use-After-Free / Double Free | [] | int owe_process_assoc_resp(const u8 *rsn_ie, size_t rsn_len, const uint8_t *dh_ie, size_t dh_len)
{
size_t prime_len=0,hash_len=0;
struct wpabuf * sh_secret = NULL, *pub = NULL, *hkey = NULL;
const char *info = "OWE Key Generation";
u8 pmkid[SHA256_MAC_LEN], prk[SHA256_MAC_LEN], pmk[SHA256_MAC_LEN];
... | int owe_process_assoc_resp(const u8 *rsn_ie, size_t rsn_len, const uint8_t *dh_ie, size_t dh_len)
{
size_t prime_len=0,hash_len=0;
struct wpabuf * sh_secret = NULL, *pub = NULL, *hkey = NULL;
const char *info = "OWE Key Generation";
u8 pmkid[SHA256_MAC_LEN], prk[SHA256_MAC_LEN], pmk[SHA256_MAC_LEN];
... | https://github.com/espressif/esp-idf/commit/d9ba2da026b2c5ae62f17c2fdfdcc724c2abbbf4 | 2026-07-31T07:03:11 | 3 | 0 | C | 19,172 | Apache-2.0 | 31505d883803fcf56df35a365ddd924ef5c652828f63d9b3340dead769e68ecc | null | null | [] |
espressif/esp-idf | d9ba2da026b2c5ae62f17c2fdfdcc724c2abbbf4 | fix(wifi): Prevent double free in owe failure path | components\wpa_supplicant\src\rsn_supp\wpa.c | owe_build_assoc_req | Use-After-Free / Double Free | [] | struct wpabuf *owe_build_assoc_req(struct wpa_sm *sm, u16 group)
{
struct wpabuf *pub = NULL;
size_t prime_len;
if (group == OWE_DH_GRP19) {
prime_len = OWE_PRIME_LEN;
} else {
wpa_printf(MSG_ERROR, "OWE: Unsupported Diffie-Hellman group");
return NULL;
}
sm->owe_ecdh =... | struct wpabuf *owe_build_assoc_req(struct wpa_sm *sm, u16 group)
{
struct wpabuf *pub = NULL;
size_t prime_len;
if (group == OWE_DH_GRP19) {
prime_len = OWE_PRIME_LEN;
} else {
wpa_printf(MSG_ERROR, "OWE: Unsupported Diffie-Hellman group");
return NULL;
}
sm->owe_ecdh =... | https://github.com/espressif/esp-idf/commit/d9ba2da026b2c5ae62f17c2fdfdcc724c2abbbf4 | 2026-07-31T07:03:11 | 1 | 0 | C | 19,172 | Apache-2.0 | dd3f5dc7de1b9ccbac77afe44ce2ab285c4b13e0826efd9741fb13bdcad7bfa3 | null | null | [] |
espressif/esp-idf | 49fba58f081390e17cdb7f482020784d64a7dee0 | fix(riscv_trace): protect shared RCC register access with PERIPH_RCC_ATOMIC
riscv_trace_ll_enable_bus_clock and riscv_trace_ll_reset_register operate
on shared HP_SYS_CLKRST registers and were called concurrently from both
cores during SECONDARY init, creating RMW race conditions.
Move the clock/reset logic out of th... | components\esp_hal_debug_assist\riscv_trace_hal.c | riscv_trace_hal_deinit | General Vulnerability | [] | void riscv_trace_hal_deinit(riscv_trace_hal_context_t *ctx)
{
HAL_ASSERT(ctx != NULL);
riscv_trace_ll_set_restart_ena(ctx->dev, false);
riscv_trace_ll_trigger_off(ctx->dev);
riscv_trace_ll_set_intr_ena(ctx->dev, 0);
riscv_trace_ll_enable_module_clock(ctx->dev, false);
} | void riscv_trace_hal_deinit(riscv_trace_hal_context_t *ctx)
{
HAL_ASSERT(ctx != NULL);
riscv_trace_ll_set_restart_ena(ctx->dev, false);
riscv_trace_ll_trigger_off(ctx->dev);
riscv_trace_ll_set_intr_ena(ctx->dev, 0);
} | https://github.com/espressif/esp-idf/commit/49fba58f081390e17cdb7f482020784d64a7dee0 | 2026-07-22T11:02:58 | 0 | 1 | C | 19,172 | Apache-2.0 | cd0edf9eb0a453e67efed7e06617c8d1375a971918b01f9668ad7ababa47fbf1 | null | null | [] |
espressif/esp-idf | 49fba58f081390e17cdb7f482020784d64a7dee0 | fix(riscv_trace): protect shared RCC register access with PERIPH_RCC_ATOMIC
riscv_trace_ll_enable_bus_clock and riscv_trace_ll_reset_register operate
on shared HP_SYS_CLKRST registers and were called concurrently from both
cores during SECONDARY init, creating RMW race conditions.
Move the clock/reset logic out of th... | components\esp_hal_debug_assist\riscv_trace_hal.c | riscv_trace_hal_init | General Vulnerability | [] | void riscv_trace_hal_init(int core_id, const riscv_trace_hal_config_t *config, riscv_trace_hal_context_t *ctx)
{
HAL_ASSERT(ctx != NULL && config != NULL);
HAL_ASSERT(config->mem_end_addr > config->mem_start_addr);
ctx->dev = riscv_trace_ll_get_hw(core_id);
ctx->core_id = core_id;
riscv_trace_hal_... | void riscv_trace_hal_init(int core_id, const riscv_trace_hal_config_t *config, riscv_trace_hal_context_t *ctx)
{
HAL_ASSERT(ctx != NULL && config != NULL);
HAL_ASSERT(config->mem_end_addr > config->mem_start_addr);
ctx->dev = riscv_trace_ll_get_hw(core_id);
ctx->core_id = core_id;
/* Memory config... | https://github.com/espressif/esp-idf/commit/49fba58f081390e17cdb7f482020784d64a7dee0 | 2026-07-22T11:02:58 | 0 | 2 | C | 19,172 | Apache-2.0 | 38cda29de31ff01b23c6bb35af8d7d1930d3dbdf3a25cc4b1a2e723e7f777363 | null | null | [] |
espressif/esp-idf | 49fba58f081390e17cdb7f482020784d64a7dee0 | fix(riscv_trace): protect shared RCC register access with PERIPH_RCC_ATOMIC
riscv_trace_ll_enable_bus_clock and riscv_trace_ll_reset_register operate
on shared HP_SYS_CLKRST registers and were called concurrently from both
cores during SECONDARY init, creating RMW race conditions.
Move the clock/reset logic out of th... | components\esp_riscv_trace\src\esp_riscv_trace.c | ESP_SYSTEM_INIT_FN | General Vulnerability | [] | ESP_SYSTEM_INIT_FN(esp_riscv_trace_early_init, SECONDARY, ESP_SYSTEM_INIT_ALL_CORES, 160)
{
int core_id = esp_cpu_get_core_id();
esp_riscv_trace_config_t config = esp_riscv_trace_get_user_config(core_id);
if (!is_valid_core_mask(config.core_mask)) {
ESP_EARLY_LOGE(TAG, "invalid core mask");
... | ESP_SYSTEM_INIT_FN(esp_riscv_trace_early_init, SECONDARY, ESP_SYSTEM_INIT_ALL_CORES, 160)
{
int core_id = esp_cpu_get_core_id();
esp_riscv_trace_config_t config = esp_riscv_trace_get_user_config(core_id);
// Enable the clocks and reset the encoder core before accessing its registers.
PERIPH_RCC_ATOMIC(... | https://github.com/espressif/esp-idf/commit/49fba58f081390e17cdb7f482020784d64a7dee0 | 2026-07-22T11:02:58 | 6 | 0 | C | 19,172 | Apache-2.0 | 9f1cbd2b5ab6c593cbf03389391e13e491b1b762ae51add67bb46e19fffc0133 | null | null | [] |
espressif/esp-idf | 62e507ab8e43446764928553a8a88311dcc3792e | fix(log): fix out-of-bounds reads in binary log for buffer log apis
- Fix MAX(len,2) reading beyond buffer when len=1
- Fix buffer_len=0 ambiguity with strlen fallback
- Add BUFFER_LEN_NOT_SET sentinel (-1)
- Read exactly len bytes, not forced minimum
Merges https://github.com/espressif/esp-idf/pull/18825 | components\log\src\log_format_binary.c | output_pointer | Buffer Overflow | [] | static unsigned output_pointer(const char *ptr, pkg_info_t *pkg_info)
{
unsigned pkg_len = 0;
uintptr_t addr = (uintptr_t)ptr;
if (PRESENT_IN_ELF(addr) || addr == 0) {
pkg_len = output(&addr, sizeof(addr), pkg_info);
} else {
int len = (pkg_info->buffer_len) ? pkg_info->buffer_len : strl... | static unsigned output_pointer(const char *ptr, pkg_info_t *pkg_info)
{
unsigned pkg_len = 0;
uintptr_t addr = (uintptr_t)ptr;
if (PRESENT_IN_ELF(addr) || addr == 0) {
pkg_len = output(&addr, sizeof(addr), pkg_info);
} else {
int data_len = (pkg_info->buffer_len != BUFFER_LEN_NOT_SET) ? ... | https://github.com/espressif/esp-idf/commit/62e507ab8e43446764928553a8a88311dcc3792e | 2026-07-21T13:47:50 | 8 | 3 | C | 19,172 | Apache-2.0 | 877db6cbb46bc7e5ffe313f12a568368a952ed8ed14e61e914966c4aa8456cff | null | null | [] |
espressif/esp-idf | 62e507ab8e43446764928553a8a88311dcc3792e | fix(log): fix out-of-bounds reads in binary log for buffer log apis
- Fix MAX(len,2) reading beyond buffer when len=1
- Fix buffer_len=0 ambiguity with strlen fallback
- Add BUFFER_LEN_NOT_SET sentinel (-1)
- Read exactly len bytes, not forced minimum
Merges https://github.com/espressif/esp-idf/pull/18825 | components\log\src\log_format_binary.c | esp_log_format_binary | Buffer Overflow | [] | void esp_log_format_binary(esp_log_msg_t *message)
{
assert(message != NULL);
if (!message->config.opts.constrained_env) {
esp_log_impl_lock();
}
pkg_info_t pkg_info = {
.crc = 0,
.buffer_hex_log = message->format == __ESP_BUFFER_HEX_FORMAT__,
.buffer_char_log = message... | void esp_log_format_binary(esp_log_msg_t *message)
{
assert(message != NULL);
if (!message->config.opts.constrained_env) {
esp_log_impl_lock();
}
pkg_info_t pkg_info = {
.crc = 0,
.buffer_hex_log = message->format == __ESP_BUFFER_HEX_FORMAT__,
.buffer_char_log = message... | https://github.com/espressif/esp-idf/commit/62e507ab8e43446764928553a8a88311dcc3792e | 2026-07-21T13:47:50 | 1 | 1 | C | 19,172 | Apache-2.0 | 427af6d5e63f68c1baf90e3d81ffa617d0bdfe3d0399a23f668c7bdb8874920a | null | null | [] |
espressif/esp-idf | 62e507ab8e43446764928553a8a88311dcc3792e | fix(log): fix out-of-bounds reads in binary log for buffer log apis
- Fix MAX(len,2) reading beyond buffer when len=1
- Fix buffer_len=0 ambiguity with strlen fallback
- Add BUFFER_LEN_NOT_SET sentinel (-1)
- Read exactly len bytes, not forced minimum
Merges https://github.com/espressif/esp-idf/pull/18825 | components\log\src\log_format_binary.c | calc_pkg_len | Buffer Overflow | [] | static unsigned calc_pkg_len(esp_log_msg_t *message, pkg_info_t *pkg_info)
{
unsigned pkg_len = 0;
pkg_info->len_calculation_stage = true;
pkg_len += sizeof(control_t);
pkg_len += output_pointer(message->format, pkg_info);
pkg_len += output_pointer(message->tag, pkg_info);
pkg_len += (message->t... | static unsigned calc_pkg_len(esp_log_msg_t *message, pkg_info_t *pkg_info)
{
unsigned pkg_len = 0;
pkg_info->len_calculation_stage = true;
pkg_len += sizeof(control_t);
pkg_len += output_pointer(message->format, pkg_info);
pkg_len += output_pointer(message->tag, pkg_info);
pkg_len += (message->t... | https://github.com/espressif/esp-idf/commit/62e507ab8e43446764928553a8a88311dcc3792e | 2026-07-21T13:47:50 | 1 | 0 | C | 19,172 | Apache-2.0 | 9202a6fa8249b802a063e89b275d372a0f9dd801ec3bada43d011cde13325672 | null | null | [] |
espressif/esp-idf | 4ab4d5b8947cb682bc86c83b291c27647f2c79fd | fix(esp_event): use recursive mutex API in handler unregister (SEC-220)
1) loop->mutex is created with xSemaphoreCreateRecursiveMutex(). FreeRTOS
requires that recursive mutexes are only acquired and released with
xSemaphoreTakeRecursive / xSemaphoreGiveRecursive.
esp_event_handler_unregister_with_internal() used the... | components\esp_event\esp_event.c | esp_event_handler_unregister_with_internal | Use-After-Free / Double Free | [] | esp_err_t esp_event_handler_unregister_with_internal(esp_event_loop_handle_t event_loop, esp_event_base_t event_base,
int32_t event_id, esp_event_handler_instance_context_t* handler_ctx, bool legacy)
{
assert(event_loop);
assert(handler_ctx);
if (event_b... | esp_err_t esp_event_handler_unregister_with_internal(esp_event_loop_handle_t event_loop, esp_event_base_t event_base,
int32_t event_id, esp_event_handler_instance_context_t* handler_ctx, bool legacy)
{
assert(event_loop);
assert(handler_ctx);
if (event_b... | https://github.com/espressif/esp-idf/commit/4ab4d5b8947cb682bc86c83b291c27647f2c79fd | 2026-07-21T12:25:57 | 18 | 4 | C | 19,172 | Apache-2.0 | e4b34a5e4440e4ed9ca40ae1b24df67fc9bcf5a1dae39cf759096c66c48aecdc | null | null | [] |
espressif/esp-idf | 694032c1b107e816503df089b631417c15cc1c1f | fix(esp_timer): avoid dump buffer overflow
print_timer_info advanced the dump cursor by snprintf's return value. When a timer line was truncated, snprintf returned the full would-be length, which could move the cursor past the heap buffer and wrap the remaining size before the next write. Add a bounded append helper t... | components\esp_timer\src\esp_timer.c | print_timer_info | Buffer Overflow | [] | static void print_timer_info(esp_timer_handle_t t, char** dst, size_t* dst_size)
{
#if WITH_PROFILING
size_t cb;
// name is optional, might be missed.
if (t->name) {
cb = snprintf(*dst, *dst_size, "%-20.20s ", t->name);
} else {
cb = snprintf(*dst, *dst_size, "timer@%-10p ", t);
}
... | static void print_timer_info(esp_timer_handle_t t, char** dst, size_t* dst_size)
{
#if WITH_PROFILING
// name is optional, might be missed.
if (t->name) {
append_to_buffer(dst, dst_size, "%-20.20s ", t->name);
} else {
append_to_buffer(dst, dst_size, "timer@%-10p ", t);
}
append_t... | https://github.com/espressif/esp-idf/commit/694032c1b107e816503df089b631417c15cc1c1f | 2026-07-13T06:45:00 | 6 | 9 | C | 19,172 | Apache-2.0 | 7974c8ef9715d083a93b99ddc3920bb1df899e146c3d1aa3153f5cf54e8ea6fc | null | null | [] |
espressif/esp-idf | 694032c1b107e816503df089b631417c15cc1c1f | fix(esp_timer): avoid dump buffer overflow
print_timer_info advanced the dump cursor by snprintf's return value. When a timer line was truncated, snprintf returned the full would-be length, which could move the cursor past the heap buffer and wrap the remaining size before the next write. Add a bounded append helper t... | components\esp_timer\src\esp_timer.c | esp_timer_dump | Buffer Overflow | [] | esp_err_t esp_timer_dump(FILE* stream)
{
/* Since timer lock is a critical section, we don't want to print directly
* to stdout, since that may cause a deadlock if stdout is interrupt-driven
* (via the UART driver). Allocate sufficiently large chunk of memory first,
* print to it, then dump this memo... | esp_err_t esp_timer_dump(FILE* stream)
{
/* Since timer lock is a critical section, we don't want to print directly
* to stdout, since that may cause a deadlock if stdout is interrupt-driven
* (via the UART driver). Allocate sufficiently large chunk of memory first,
* print to it, then dump this memo... | https://github.com/espressif/esp-idf/commit/694032c1b107e816503df089b631417c15cc1c1f | 2026-07-13T06:45:00 | 1 | 0 | C | 19,172 | Apache-2.0 | a9f04ef5fcd51abefb7a6bb261f8cb87016c2d09e3a2d2043da18a4c5dccfa7d | null | null | [] |
espressif/esp-idf | daae1fb403b36fc0f9fc57ccdfc20fad458f13e8 | fix(esp_partition): prevent size_t overflow bypassing bounds checks on linux target
esp_partition_write/read/erase_range/mmap in partition_linux.c (the
`linux` target backend used by --preview set-target linux / host_test)
validated the requested range with `offset + size > partition->size`.
When `size` is close to SI... | components\esp_partition\partition_linux.c | esp_partition_write | Buffer Overflow | [] | esp_err_t esp_partition_write(const esp_partition_t *partition, size_t dst_offset, const void *src, size_t size)
{
assert(partition != NULL && s_spiflash_mem_file_buf != NULL && src != NULL);
if (partition->readonly) {
return ESP_ERR_NOT_ALLOWED;
}
if (partition->encrypted) {
return ESP... | esp_err_t esp_partition_write(const esp_partition_t *partition, size_t dst_offset, const void *src, size_t size)
{
assert(partition != NULL && s_spiflash_mem_file_buf != NULL && src != NULL);
if (partition->readonly) {
return ESP_ERR_NOT_ALLOWED;
}
if (partition->encrypted) {
return ESP... | https://github.com/espressif/esp-idf/commit/daae1fb403b36fc0f9fc57ccdfc20fad458f13e8 | 2026-07-11T19:30:37 | 1 | 1 | C | 19,172 | Apache-2.0 | 156cb61dfcaf3a94de44b6294bf5cd24a9ba599a2e6b19099041b7fddc7b68c9 | 18,822 | fix(esp_partition): prevent size_t overflow bypassing bounds checks on linux target (IDFGH-17957) | [
"Status: Done",
"Resolution: Done",
"PR-Sync-Merge"
] |
End of preview. Expand in Data Studio
C/C++ Security Vulnerability & Automated Patch Dataset for llms fine tuning
A large-scale corpus of 23,826 function-level vulnerability repair pairs ($Vulnerable \rightarrow Fixed$) mined from 64 major C/C++ open-source projects spanning 12,130 unique commits identified by the security-focused mining pipeline.
This dataset is specifically structured for Automated Program Repair (APR), Vulnerability Assessment, and Instruction Fine-Tuning of Code LLMs (e.g., Qwen2.5-Coder, DeepSeek-Coder, CodeLlama).
Dataset Summary
- Total Samples:
23,826function pairs - Source Repositories:
64curated open-source C/C++ codebases - Unique Commits:
12,130identified by the security-focused mining pipeline - Median Patch Size:
+3lines added,-1line deleted - Exact Duplicate Pairs:
0according topair_hash(23,790 unique vulnerable functions, 23,810 unique fixed functions) - Token Distribution (BPE - Qwen2.5-Coder):
- Vulnerable Code: Median 363 tokens (P95: 1,993)
- Fixed Code: Median 379 tokens (P95: 2,026)
- Full SFT Training Prompt: Median 846 tokens (P95: 4,116; 94.95% fit in $\le 4,096$)
Mining Methodology
The dataset was mined using an automated git-mining and static AST function extraction pipeline:
- Repository Selection: 64 active, mission-critical C/C++ codebases across systems programming, cryptography, operating systems, embedded firmware, networking, virtualization, and parsers.
- Commit Filtering: Commits were identified using security-focused regex patterns in commit messages (e.g., CVE IDs, memory corruption taxonomy terms, security advisories).
- Function Extraction: For each modified
.c,.cpp,.cc, or.hfile in a security commit, the pipeline used AST/heuristic function parsing to extract the exact enclosing function before (vulnerable_code) and after (fixed_code) the commit. - Structural Validation: Multi-file diffs and refactorings were isolated to function boundaries. Function pairs where syntax was unextractable or unchanged were discarded.
Dataset Schema & Field Descriptions
Each row in dataset_vuln_pairs.jsonl is a JSON object with the following fields:
| Field Name | Type | Description |
|---|---|---|
pair_hash |
string |
Unique SHA-256 hash computed over normalized code: hashlib.sha256(f"{vulnerable_code.strip()}|||{fixed_code.strip()}".encode("utf-8")).hexdigest(). |
repo_name |
string |
GitHub repository identifier (e.g., openssl/openssl, torvalds/linux, redis/redis). |
commit_hash |
string |
Full Git commit SHA where the patch was applied. |
commit_message |
string |
Complete commit message from the developer explaining the patch. |
commit_date |
string |
ISO 8601 timestamp of the commit. |
file_path |
string |
Relative path to the modified file within the repository. |
function_name |
string |
Name of the extracted C/C++ function. |
vulnerable_code |
string |
Complete source code of the function before the security fix. |
fixed_code |
string |
Complete source code of the function after the security fix. |
vuln_category |
string |
Primary vulnerability taxonomy classified from commit semantics (e.g., Buffer Overflow, Memory Leak, Use After Free, Null Pointer Dereference). |
cve_ids |
list[string] |
List of explicit Common Vulnerabilities and Exposures IDs mentioned in the commit (e.g., ["CVE-2023-0286"]). |
source_url |
string |
Direct permalink to the commit on GitHub. |
Known Limitations & Usage Recommendations
- Mined Signals vs. Ground Truth: Vulnerability categories and security designations are derived from developer commit messages and metadata (weak supervision). While indicative of security-relevant code modifications, they have not undergone manual line-by-line verification by security researchers.
- Backport & Sibling Repository Clusters: Sibling projects and forks (e.g.,
openssl$\leftrightarrow$boringssl$\leftrightarrow$libressl, ortcpdump$\leftrightarrow$libpcap) share commit histories and backported patches. Users should perform group-aware / cluster-aware splits to ensure all sibling repositories reside together in either the train or test partition. - Commit Co-Occurrence: 32.3% of commits modified more than one function. When creating train/val/test splits, always split by Commit SHA or Repository, never by individual row indices.
- Token Truncation: For models with a 4,096 token context window, 94.95% of pairs fit without truncation. For ~99.85% coverage, use an 8,192-token context window (only 36 outliers exceed 8k).
Quickstart Usage
import json
def load_dataset(filepath="dataset_vuln_pairs.jsonl"):
with open(filepath, "r", encoding="utf-8") as f:
for line in f:
yield json.loads(line)
# Example: Inspect Gold-Tier CVE samples
for sample in load_dataset():
if sample["cve_ids"]:
print(f"[{sample['repo_name']}] {sample['cve_ids']} - {sample['function_name']}")
print(f"Commit: {sample['commit_message'].splitlines()[0]}")
break
Provenance & License
- Dataset Aggregation & Tooling License: MIT License. The MIT license covers the dataset packaging, schemas, mining tooling, and documentation.
- Source Code Snippet Provenance: The underlying C/C++ function snippets originate from public open-source projects hosted on GitHub and remain subject to their respective upstream licenses (e.g., GPL-2.0, Apache-2.0, MIT, BSD, MPL). The dataset aggregation license does not alter or supersede the upstream license terms of individual code snippets. Users must adhere to upstream licenses when using these code snippets.
- Downloads last month
- -