How to apply C++ fuzzing test on function that has nested Google protobuf arguments?

51 views Asked by At

I'm trying to apply llvm fuzzer on my function which might have some very complicated nested Google protobuf as arguments to find possible crashes.

The testing code is shown below:

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
    MyProtoBufferType proto;
    if (!proto.ParseFromArray(data, size)) {
        // Handle parse error if necessary
        return 0;
    }

    // Call your function with the populated protobuf object
    myFunction(proto);

    return 0;
}

My question is:

  1. How could the proto.ParseFromArray(data, size) succeed? It should be extreamly hard for the data to be parsed into my proto structure correctly(or I'm not sure if the correctness is not important under this circumstance), right?

  2. Is there a more recommended approach for my situation?

0

There are 0 answers