fuzzing - fix some wrong types and -lcrypt on macos

This commit is contained in:
Matt Johnston 2020-11-02 20:33:48 +08:00
parent 121e6e6202
commit 24cfda9e3c
4 changed files with 6 additions and 5 deletions

View File

@ -290,7 +290,7 @@ fuzzstandalone: fuzz/fuzz-harness.o fuzz-targets
fuzz-targets: $(FUZZ_TARGETS) $(FUZZER_OPTIONS) fuzz-targets: $(FUZZ_TARGETS) $(FUZZER_OPTIONS)
$(FUZZ_TARGETS): $(FUZZ_OBJS) $(allobjs) $(LIBTOM_DEPS) $(FUZZ_TARGETS): $(FUZZ_OBJS) $(allobjs) $(LIBTOM_DEPS)
$(CXX) $(CXXFLAGS) fuzz/$@.o $(LDFLAGS) $(allobjs) -o $@$(EXEEXT) $(LIBTOM_LIBS) $(LIBS) $(FUZZLIB) -lcrypt $(CXX) $(CXXFLAGS) fuzz/$@.o $(LDFLAGS) $(allobjs) -o $@$(EXEEXT) $(LIBTOM_LIBS) $(LIBS) $(FUZZLIB) @CRYPTLIB@
# fuzzers that use the custom mutator - these expect a SSH network stream # fuzzers that use the custom mutator - these expect a SSH network stream
MUTATOR_FUZZERS=fuzzer-client fuzzer-client_nomaths \ MUTATOR_FUZZERS=fuzzer-client fuzzer-client_nomaths \

View File

@ -239,7 +239,7 @@ int fuzz_run_preauth(const uint8_t *Data, size_t Size, int skip_kexmaths) {
} }
uint32_t wrapseed; uint32_t wrapseed;
genrandom(&wrapseed, sizeof(wrapseed)); genrandom((void*)&wrapseed, sizeof(wrapseed));
wrapfd_setseed(wrapseed); wrapfd_setseed(wrapseed);
int fakesock = wrapfd_new(); int fakesock = wrapfd_new();
@ -275,7 +275,7 @@ int fuzz_run_client(const uint8_t *Data, size_t Size, int skip_kexmaths) {
ses.kexstate.donefirstkex = 1; ses.kexstate.donefirstkex = 1;
uint32_t wrapseed; uint32_t wrapseed;
genrandom(&wrapseed, sizeof(wrapseed)); genrandom((void*)&wrapseed, sizeof(wrapseed));
wrapfd_setseed(wrapseed); wrapfd_setseed(wrapseed);
int fakesock = wrapfd_new(); int fakesock = wrapfd_new();

View File

@ -47,7 +47,8 @@ int main(int argc, char ** argv) {
return 0; return 0;
} }
size_t LLVMFuzzerMutate(uint8_t *Data, size_t Size, size_t MaxSize) { // Just to let it link
size_t LLVMFuzzerMutate(uint8_t *UNUSED(Data), size_t UNUSED(Size), size_t UNUSED(MaxSize)) {
printf("standalone fuzzer harness shouldn't call LLVMFuzzerMutate"); printf("standalone fuzzer harness shouldn't call LLVMFuzzerMutate");
abort(); abort();
return 0; return 0;

View File

@ -285,7 +285,7 @@ size_t LLVMFuzzerCustomCrossOver(const uint8_t *Data1, size_t Size1,
unsigned int num_out = min_out + nrand48(randstate) % (max_out-min_out+1); unsigned int num_out = min_out + nrand48(randstate) % (max_out-min_out+1);
for (i = 0; i < num_out; i++) { for (i = 0; i < num_out; i++) {
int choose = nrand48(randstate) % (num_packets1 + num_packets2); unsigned int choose = nrand48(randstate) % (num_packets1 + num_packets2);
buffer *p = NULL; buffer *p = NULL;
if (choose < num_packets1) { if (choose < num_packets1) {
p = packets1[choose]; p = packets1[choose];