Commit 57001ce3 authored by Max Dymond's avatar Max Dymond Committed by Daniel Stenberg
Browse files

ossfuzz: Move to C++ for curl_fuzzer.

Automake gets confused if you want to use C++ static libraries with C
code - basically we need to involve the clang++ linker. The easiest way
of achieving this is to rename the C code as C++ code. This gets us a
bit further along the path and ought to be compatible with Google's
version of clang.
parent c290b8fb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -55,3 +55,4 @@ test-driver
scripts/_curl
curl_fuzzer
curl_fuzzer_seed_corpus.zip
libstandaloneengine.a
+5 −0
Original line number Diff line number Diff line
@@ -145,7 +145,12 @@ script:
    - |
        if [ "$T" = "fuzzer" ]; then
          export CC=clang
          export CXX=clang++
          export CFLAGS="-fsanitize=address"

          # Specifically use libstdc++ for travis as libc++ is not installed.
          # This is ok because we're not compiling against libFuzzer.
          export CXXFLAGS="-fsanitize=address -stdlib=libstdc++"
          ./configure --disable-shared --enable-debug --enable-maintainer-mode
          make
          cd tests/fuzz
+1 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ CURL_CHECK_OPTION_RT

XC_CHECK_PATH_SEPARATOR
AX_CODE_COVERAGE
AC_PROG_CXX

#
# save the configure arguments
+6 −6
Original line number Diff line number Diff line
@@ -30,12 +30,12 @@ AUTOMAKE_OPTIONS = foreign nostdinc
# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files

AM_CFLAGS = -I$(top_srcdir)/include        \
AM_CXXFLAGS = -I$(top_srcdir)/include        \
              -I$(top_builddir)/lib          \
              -I$(top_srcdir)/lib            \
              -I$(top_srcdir)/tests/fuzz

LIBS = -lpthread -lstdc++ -lm
LIBS = -lpthread -lm

# Run e.g. "make all LIB_FUZZING_ENGINE=/path/to/libFuzzer.a"
# to link the fuzzer(s) against a real fuzzing engine.
+5 −5
Original line number Diff line number Diff line
FUZZPROGS = curl_fuzzer
FUZZLIBS = libstandaloneengine.a

curl_fuzzer_SOURCES = curl_fuzzer.c
curl_fuzzer_CFLAGS = $(AM_CFLAGS)
curl_fuzzer_SOURCES = curl_fuzzer.cc
curl_fuzzer_CXXFLAGS = $(AM_CXXFLAGS)

libstandaloneengine_a_SOURCES = standalone_fuzz_target_runner.c
libstandaloneengine_a_CFLAGS = $(AM_CFLAGS)
libstandaloneengine_a_SOURCES = standalone_fuzz_target_runner.cc
libstandaloneengine_a_CXXFLAGS = $(AM_CXXFLAGS)

# Some more targets.
zip:
Loading