Skip to content

Commit

Permalink
fix: adjusted fuzzing mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
n4l5u0r committed Nov 30, 2024
1 parent 98f9f92 commit 7508d8c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
6 changes: 5 additions & 1 deletion fuzzing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,8 @@ add_executable(fuzz
)

target_compile_options(fuzz PUBLIC ${COMPILATION_FLAGS})
target_link_options(fuzz PUBLIC ${COMPILATION_FLAGS})
target_link_options(fuzz PUBLIC ${COMPILATION_FLAGS})

if (CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-gdwarf-4)
endif()
7 changes: 7 additions & 0 deletions fuzzing/mocks.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "paraswap_plugin.h"
#include "lcx_common.h"
#include "lcx_hash.h"
#include "mocks.h"
#include <stddef.h>

size_t strlcat(char *dst, const char *src, size_t size) {
Expand Down Expand Up @@ -45,4 +46,10 @@ cx_err_t cx_keccak_256_hash_iovec(const cx_iovec_t *iovec,

void os_sched_exit(bolos_task_status_t exit_code) {
return;
}

// Mock implementation of pic function for fuzzing
void *pic(void *addr) {
// In fuzzing environment, just return the address directly
return addr;
}
9 changes: 9 additions & 0 deletions fuzzing/mocks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef _MOCKS_H_
#define _MOCKS_H_

// Add other existing mock declarations...

// Declaration for pic function
void *pic(void *addr);

#endif // _MOCKS_H_
1 change: 0 additions & 1 deletion src/handle_init_contract.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "paraswap_plugin.h"
#include "os_pic.h"

// Called once to init.
void handle_init_contract(ethPluginInitContract_t *parameters) {
Expand Down

0 comments on commit 7508d8c

Please sign in to comment.