commit | 7f897aa077f456efbca1d0aba1a03c06df86fbce | [log] [tgz] |
---|---|---|
author | Vitaly Buka <vitalybuka@chromium.org> | Wed Jan 11 16:14:02 2017 -0800 |
committer | Vitaly Buka <vitalybuka@gmail.com> | Thu Jan 12 11:27:06 2017 -0800 |
tree | ec2a51d2d8a09f3d18db5713302c6af4ca4d3dff | |
parent | 27c3959a43c48b3d2396029ce0d9aa11bdaae6ec [diff] |
Add build into ignore list.
libprotobuf-mutator is a library to randomly mutate protobuffers.
It could be used together with guided fuzzing engines, such as libFuzzer.
Install prerequisites:
sudo apt-get update sudo apt-get install binutils cmake ninja-build
Compile and test everything:
mkdir build cd build cmake ../cmake/ -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug ninja check
Clang is only needed for libFuzzer integration.
To use libprotobuf-mutator simply include protobuf_mutator.h and protobuf_mutator.cc into your build files.
The ProtobufMutator
class implements mutations of the protobuf tree structure and mutations of individual fields. The field mutation logic is very basic -- for better results you should override the ProtobufMutator::Mutate*
methods with more sophisticated logic, e.g. using libFuzzer's mutators.
To apply one mutation to a protobuf object do the following:
class MyProtobufMutator : public ProtobufMutator { public: MyProtobufMutator(uint32_t seed) : ProtobufMutator(seed) {} // Optionally redefine the Mutate* methods to perform more sophisticated mutations. } void Mutate(MyMessage* message) { MyProtobufMutator mutator(my_random_seed); mutator.Mutate(message, 200); }
See also the ProtobufMutatorMessagesTest.UsageExample
test from protobuf_mutator_test.cc.
LibFuzzerProtobufMutator can help to integrate with libFuzzer. Please see libfuzzer_example.cc as an example.