Skip to content

Commit

Permalink
fix msan-problems in fuzzer-environment
Browse files Browse the repository at this point in the history
  • Loading branch information
linderd committed Dec 11, 2023
1 parent cabc947 commit 25c3a81
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .clusterfuzzlite/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -eu

# build project
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCLUSTERFUZZ=ON
cmake -S . -B build -DCMAKE_BUILD_TYPE=DEBUG -DCLUSTERFUZZ=ON
cmake --build build

# copy binary and dict to $OUT
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ if(CLUSTERFUZZ)
add_subdirectory(regress/parser-libfuzzer)
if (NOT DEFINED ENV{CLUSTERFUZZLITE})
set(CMAKE_C_COMPILER clang)
string(APPEND CMAKE_C_FLAGS " -g -O1 -fsanitize=fuzzer-no-link")
string(APPEND CMAKE_C_FLAGS " -g -O0 -fsanitize=fuzzer-no-link")
endif()
endif()
add_subdirectory(compat)
Expand Down
1 change: 1 addition & 0 deletions iked/ikev2_pld.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#include <stdint.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/uio.h>
Expand Down
2 changes: 2 additions & 0 deletions regress/parser-libfuzzer/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <event.h>
#include <limits.h>
#include <string.h>

#include "iked.h"
#include "types.h"
Expand Down Expand Up @@ -162,6 +163,7 @@ ssize_t
ikev2_nat_detection(struct iked *env, struct iked_message *msg,
void *ptr, size_t len, u_int type, int frompeer)
{
bzero(ptr, len);
return (0);
}

Expand Down
1 change: 1 addition & 0 deletions regress/parser-libfuzzer/run_test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh

# script to run the parser-fuzzer for 5 minutes with the right options
# use repo github.com/openiked-portable/corpus as corpus for faster results

# ASAN-option to help finding the source of memory leaks
export ASAN_OPTIONS=fast_unwind_on_malloc=0
Expand Down

0 comments on commit 25c3a81

Please sign in to comment.