extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (size <= 4) return 0;
// Extract Bytecode length:
uint8_t codeLen =data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
if (codeLen+4 < size){
return 0;
}
uint8_t *code = &data[4];
uint8_t *input = &data[4+codeLen];
execByteCode(code,codeLen,input,size-codeLen-4); return 0; }
But this does not seem satisfactory to me: One because it dismisses a lot of input libFuzzer generates.
And second because I have a hunch that it biases the Fuzzer towards generating longer files, because the codeLen
numbers can get really big (But this might as well not be true). I have thought about multiple other splitting
methods, but none that really satisfied me.
So my question is, what is best practice when encountering such a scenario?
Best & Thanks,
Vincent
Hi,
I want to fuzz a function that accepts multiple arguments.In particular, I want to fuzz a function that accepts "bytecode" and "data", given to the bytecode, when that particular bytecode is executed. I tried to write a testharness that splits the libFuzzer input, such that the first four bytes determine how much of the input is code and the rest of the LibFuzzer input is given to the function as data. So the code of my testharness looks something like this:extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (size <= 4) return 0;
// Extract Bytecode length:
uint8_t codeLen =
data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
if (codeLen+4 < size){
return 0;
}
uint8_t *code = &data[4];
uint8_t *input = &data[4+codeLen];
execByteCode(code,codeLen,input,size-codeLen-4); return 0; }
But this does not seem satisfactory to me: One because it dismisses a lot of input libFuzzer generates.
And second because I have a hunch that it biases the Fuzzer towards generating longer files, because the codeLen
numbers can get really big (But this might as well not be true).
I have thought about multiple other splitting
methods, but none that really satisfied me.
So my question is, what is best practice when encountering such a scenario?
Best & Thanks,
Vincent
--
You received this message because you are subscribed to the Google Groups "libfuzzer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to libfuzzer+unsubscribe@googlegroups.com.
To post to this group, send email to libf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/libfuzzer/dd2946ff-0061-488c-b38f-5c81a4029c77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I thought this is a task for https://github.com/google/libprotobuf-mutator?Meaning one defines all possible input parameters, uses the protobuf-mutator to generate the actual inputs and feeds them to the function that way...
--
You received this message because you are subscribed to the Google Groups "libfuzzer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to libfuzzer+unsubscribe@googlegroups.com.
To post to this group, send email to libf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/libfuzzer/d33d02ab-0162-4b8a-84ba-4488be7c649b%40googlegroups.com.