Skip to content

Commit dbeae55

Browse files
Advenam Tacetelopez
authored andcommitted
fuzz_{base64,doh}: curl lib includes for standalone harnesses
This patch adds `-I` flag to compilation flags for standalone harnesses in Makefile.am. Variable CURLDIR is used to determine include path. This patch sets CURLDIR envvar in ossfuzz.sh, but name is taken from mainline.sh. That makes dependencies work with oss-fuzz. It should also make it work with mainline.sh
1 parent 617266b commit dbeae55

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

Makefile.am

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,15 @@ curl_fuzzer_fnmatch_CXXFLAGS = $(COMMON_FLAGS)
139139
curl_fuzzer_fnmatch_LDADD = $(COMMON_LDADD)
140140

141141
curl_fuzzer_altsvc_SOURCES = fuzz_altsvc.cc
142-
curl_fuzzer_altsvc_CXXFLAGS = $(COMMON_FLAGS)
142+
curl_fuzzer_altsvc_CXXFLAGS = $(COMMON_FLAGS) -I$(CURLDIR)
143143
curl_fuzzer_altsvc_LDADD = $(COMMON_LDADD)
144144

145145
curl_fuzzer_base64_SOURCES = fuzz_base64.cc
146-
curl_fuzzer_base64_CXXFLAGS = $(COMMON_FLAGS)
146+
curl_fuzzer_base64_CXXFLAGS = $(COMMON_FLAGS) -I$(CURLDIR)
147147
curl_fuzzer_base64_LDADD = $(COMMON_LDADD)
148148

149149
curl_fuzzer_doh_SOURCES = fuzz_doh.cc
150-
curl_fuzzer_doh_CXXFLAGS = $(COMMON_FLAGS)
150+
curl_fuzzer_doh_CXXFLAGS = $(COMMON_FLAGS) -I$(CURLDIR)
151151
curl_fuzzer_doh_LDADD = $(COMMON_LDADD)
152152

153153
# Create the seed corpora zip files.

fuzz_base64.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ extern "C"
2828
#include <unistd.h>
2929
#include <inttypes.h>
3030
#include <curl/curl.h>
31-
#include "curl/lib/curl_base64.h"
32-
#include "curl/lib/curl_printf.h"
33-
#include "curl/lib/curl_memory.h"
34-
#include "curl/lib/memdebug.h"
31+
#include <lib/curl_base64.h>
32+
#include <lib/curl_printf.h>
33+
#include <lib/curl_memory.h>
34+
#include <lib/memdebug.h>
3535
#include <assert.h>
3636
}
3737

fuzz_doh.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extern "C"
3131
#include <assert.h>
3232
#define WARN_UNUSED_RESULT /* hack */
3333
#define DEBUGBUILD
34-
#include "curl/lib/dynbuf.h"
34+
#include <lib/dynbuf.h>
3535

3636
typedef enum {
3737
DOH_OK,

mainline.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -ex
66
export BUILD_ROOT=$PWD
77
SCRIPTDIR=${BUILD_ROOT}/scripts
88

9-
CURLDIR=/tmp/curl
9+
export CURLDIR=/tmp/curl
1010
OPENSSLDIR=/tmp/openssl
1111
NGHTTPDIR=/tmp/nghttp2
1212
INSTALLDIR=/tmp/curl_install

ossfuzz.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
# Save off the current folder as the build root.
2525
export BUILD_ROOT=$PWD
26+
export CURLDIR=/src/curl
2627
SCRIPTDIR=${BUILD_ROOT}/scripts
2728

2829
. ${SCRIPTDIR}/fuzz_targets
@@ -60,7 +61,7 @@ fi
6061
${SCRIPTDIR}/handle_x.sh nghttp2 ${NGHTTPDIR} ${INSTALLDIR} || exit 1
6162

6263
# Compile curl
63-
${SCRIPTDIR}/install_curl.sh /src/curl ${INSTALLDIR}
64+
${SCRIPTDIR}/install_curl.sh $CURLDIR ${INSTALLDIR}
6465

6566
# Build the fuzzers.
6667
${SCRIPTDIR}/compile_fuzzer.sh ${INSTALLDIR}

0 commit comments

Comments
 (0)