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 authored and tobhe committed Dec 12, 2023
1 parent cabc947 commit d4fef09
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .clusterfuzzlite/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM gcr.io/oss-fuzz-base/base-builder:v1

ENV CLUSTERFUZZLITE=TRUE
RUN apt-get update && apt-get install -y bison libssl-dev libevent-dev libsystemd-dev
RUN apt-get update && apt-get install -y bison libssl-dev libevent-dev
COPY . $SRC/openiked-portable
WORKDIR openiked-portable
COPY .clusterfuzzlite/build.sh $SRC/
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
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/openiked-fuzzing/corpus/test_libfuzzer 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 d4fef09

Please sign in to comment.