-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
I use repeated
messages in my fuzzing harness and length 0 (which it can supply) is unfortunately invalid for me. In a "classic" libFuzzer harness, whenever I get invalid input, I can reject it by returning -1
, however for some reason libprotobuf-mutator
ignores TestOneInput
return code and I get invalid protobufs in my corpus. I've tried the following to propagate the return code, but to no avail:
diff --git a/src/libfuzzer/libfuzzer_macro.h b/src/libfuzzer/libfuzzer_macro.h
index b5cb201..70c3ff4 100644
--- a/src/libfuzzer/libfuzzer_macro.h
+++ b/src/libfuzzer/libfuzzer_macro.h
@@ -74,8 +74,8 @@
using protobuf_mutator::libfuzzer::LoadProtoInput; \
Proto input; \
if (LoadProtoInput(use_binary, data, size, &input)) \
- TestOneProtoInput(input); \
- return 0; \
+ return TestOneProtoInput(input); \
+ return -1; \
}
#define DEFINE_POST_PROCESS_PROTO_MUTATION_IMPL(Proto) \
@@ -83,7 +83,7 @@
protobuf_mutator::libfuzzer::PostProcessorRegistration<Proto>;
#define DEFINE_PROTO_FUZZER_IMPL(use_binary, arg) \
- static void TestOneProtoInput(arg); \
+ static int TestOneProtoInput(arg); \
using FuzzerProtoType = \
protobuf_mutator::libfuzzer::macro_internal::GetFirstParam< \
decltype(&TestOneProtoInput)>::type; \
@@ -91,7 +91,7 @@
DEFINE_CUSTOM_PROTO_CROSSOVER_IMPL(use_binary, FuzzerProtoType) \
DEFINE_TEST_ONE_PROTO_INPUT_IMPL(use_binary, FuzzerProtoType) \
DEFINE_POST_PROCESS_PROTO_MUTATION_IMPL(FuzzerProtoType) \
- static void TestOneProtoInput(arg)
+ static int TestOneProtoInput(arg)
ligurio, Buristan and hartwork
Metadata
Metadata
Assignees
Labels
No labels