Skip to content

Commit

Permalink
ci(mdns): Fix afl host test
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cermak committed Feb 3, 2025
1 parent a4c5bfd commit d817597
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
12 changes: 11 additions & 1 deletion components/mdns/tests/test_afl_fuzz_host/esp32_mock.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
Expand Down Expand Up @@ -125,3 +125,13 @@ uint32_t esp_log_timestamp(void)
{
return 0;
}

void *heap_caps_malloc( size_t size, uint32_t caps)
{
return malloc(size);
}

void heap_caps_free( void *ptr)
{
free(ptr);
}
12 changes: 10 additions & 2 deletions components/mdns/tests/test_afl_fuzz_host/esp32_mock.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -38,6 +38,10 @@
#define ESP_ERR_INVALID_RESPONSE 0x108
#define ESP_ERR_INVALID_CRC 0x109

#define MALLOC_CAP_INTERNAL 0x1
#define MDNS_TASK_MEMORY_LOG "internal RAM"
#define MALLOC_CAP_8BIT 5

#define pdTRUE true
#define pdFALSE false
#define pdPASS ( pdTRUE )
Expand All @@ -62,6 +66,7 @@
#define vSemaphoreDelete(s) free(s)
#define queueQUEUE_TYPE_MUTEX ( ( uint8_t ) 1U
#define xTaskCreatePinnedToCore(a,b,c,d,e,f,g) *(f) = malloc(1)
#define xTaskCreateStaticPinnedToCore(a,b,c,d,e,f,g,h) true
#define vTaskDelay(m) usleep((m)*0)
#define esp_random() (rand()%UINT32_MAX)

Expand All @@ -79,7 +84,8 @@ typedef void *QueueHandle_t;
typedef void *TaskHandle_t;
typedef int BaseType_t;
typedef uint32_t TickType_t;

typedef void *StackType_t;
typedef void *StaticTask_t;

struct udp_pcb {
uint8_t dummy;
Expand Down Expand Up @@ -132,5 +138,7 @@ esp_err_t esp_event_handler_unregister(const char *event_base, int32_t event_id,
TaskHandle_t xTaskGetCurrentTaskHandle(void);
void xTaskNotifyGive(TaskHandle_t task);
BaseType_t xTaskNotifyWait(uint32_t bits_entry_clear, uint32_t bits_exit_clear, uint32_t *value, TickType_t wait_time );
void *heap_caps_malloc( size_t size, uint32_t caps);
void heap_caps_free( void *ptr);

#endif //_ESP32_COMPAT_H_

0 comments on commit d817597

Please sign in to comment.