commit | 4a6d6fc73c700d3193c8b6d0d1bb9fbc617cb852 | [log] [tgz] |
---|---|---|
author | Vitaly Buka <vitalybuka@chromium.org> | Fri Dec 16 14:21:37 2016 -0800 |
committer | Vitaly Buka <vitalybuka@google.com> | Fri Dec 16 22:22:35 2016 +0000 |
tree | 60da795789f37cf606ec03fff7c69fc82c56ec35 | |
parent | 72019dc2d923a57bd3991e5053a31f296b3eac30 [diff] |
Remove deleted argument from documentation Change-Id: I8cf211a0ddb3e6a8de1ce33bd0b129df52a8ead1 Reviewed-on: https://team-review.git.corp.google.com/57530 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
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_BUILD_TYPE=Debug ninja check
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.
TODO