Skip to content

Commit 771d9c5

Browse files
committed
Fix linking against stdc++ and fix verbosity
1 parent 71b888c commit 771d9c5

File tree

7 files changed

+180
-93
lines changed

7 files changed

+180
-93
lines changed

curl_fuzzer.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@
3030

3131
#include <libprotobuf-mutator/src/libfuzzer/libfuzzer_macro.h>
3232

33+
namespace {
34+
35+
bool FuzzOptionIsSet(const FUZZ_DATA *fuzz, CURLoption opt)
36+
{
37+
size_t idx = static_cast<size_t>(opt % 1000);
38+
if(idx >= FUZZ_CURLOPT_TRACKER_SPACE) {
39+
return false;
40+
}
41+
return fuzz->options[idx] != 0;
42+
}
43+
44+
} // namespace
45+
3346
DEFINE_BINARY_PROTO_FUZZER(const curl::fuzzer::proto::Scenario &scenario)
3447
{
3548
CurlFuzzerRunScenario(scenario);
@@ -54,6 +67,12 @@ int CurlFuzzerRunScenario(const curl::fuzzer::proto::Scenario &scenario)
5467
FV_PRINTF(&fuzz, "SCENARIO: ApplyScenario failed with rc=%d\n", rc);
5568
goto EXIT_LABEL;
5669
}
70+
71+
if(!FuzzOptionIsSet(&fuzz, CURLOPT_URL)) {
72+
FV_PRINTF(&fuzz, "SCENARIO: skipping transfer due to missing CURLOPT_URL\n");
73+
goto EXIT_LABEL;
74+
}
75+
5776
FV_PRINTF(&fuzz,
5877
"SCENARIO: successfully applied scenario, starting transfer\n");
5978

@@ -282,6 +301,7 @@ void fuzz_terminate_fuzz_data(FUZZ_DATA *fuzz)
282301
curl_formfree(fuzz->httppost);
283302
fuzz->httppost = NULL;
284303
}
304+
fuzz->last_post_part = NULL;
285305

286306
// free after httppost and last_post_part.
287307
if (fuzz->post_body != NULL) {

0 commit comments

Comments
 (0)