aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorSadaf Ebrahimi <sadafebrahimi@google.com>2022-10-20 16:54:45 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-10-20 16:54:45 +0000
commit7e7a774e315426f7eabfebd3d2b394ec3cb81808 (patch)
tree5f36135893467fd65bb194de56cb9d579cec6dd2 /README.md
parent7be9f8e9343bd9c817171bb6f4da5816041d0bbf (diff)
parent237cd6833bb8f3158227427eedbf1875ba25389e (diff)
downloadlibprotobuf-mutator-7e7a774e315426f7eabfebd3d2b394ec3cb81808.tar.gz
Original change: https://android-review.googlesource.com/c/platform/external/libprotobuf-mutator/+/2262286 Change-Id: I1d1e3425231501133f3b8d9837488d6c2529af50 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'README.md')
-rw-r--r--README.md34
1 files changed, 21 insertions, 13 deletions
diff --git a/README.md b/README.md
index ac3c247..ef78060 100644
--- a/README.md
+++ b/README.md
@@ -118,20 +118,20 @@ may corrupt the reproducer so it stops triggering the bug.
Note: You can add callback for any nested message and you can add multiple callbacks for
the same message type.
```
-DEFINE_PROTO_FUZZER(const MyMessageType& input) {
- static PostProcessorRegistration reg1 = {
- [](MyMessageType* message, unsigned int seed) {
- TweakMyMessage(message, seed);
- }};
- static PostProcessorRegistration reg2 = {
- [](MyMessageType* message, unsigned int seed) {
- DifferentTweakMyMessage(message, seed);
- }};
- static PostProcessorRegistration reg_nested = {
- [](MyMessageType::Nested* message, unsigned int seed) {
- TweakMyNestedMessage(message, seed);
- }};
+static PostProcessorRegistration<MyMessageType> reg1 = {
+ [](MyMessageType* message, unsigned int seed) {
+ TweakMyMessage(message, seed);
+ }};
+static PostProcessorRegistration<MyMessageType> reg2 = {
+ [](MyMessageType* message, unsigned int seed) {
+ DifferentTweakMyMessage(message, seed);
+ }};
+static PostProcessorRegistration<MyMessageType::Nested> reg_nested = {
+ [](MyMessageType::Nested* message, unsigned int seed) {
+ TweakMyNestedMessage(message, seed);
+ }};
+DEFINE_PROTO_FUZZER(const MyMessageType& input) {
// Code which needs to be fuzzed.
ConsumeMyMessageType(input);
}
@@ -142,6 +142,14 @@ string should be UTF-8, however only "proto3" enforces that. So if fuzzer is
applied to "proto2" type libprotobuf-mutator will generate any strings including
invalid UTF-8. If it's a "proto3" message type, only valid UTF-8 will be used.
+## Extensions
+Currently the library does not mutate
+[extensions](https://developers.google.com/protocol-buffers/docs/proto#extensions).
+This can be a problem if extension contains required fields so the library will not
+be able to change the message into valid initialized state.
+You can use [post processing hooks](#mutation-post-processing-experimental) to
+cleanup/initialize the message as workaround.
+
## Users of the library
* [Chromium](https://cs.chromium.org/search/?q=DEFINE_.*._PROTO_FUZZER%5C\()
* [Envoy](https://github.com/envoyproxy/envoy/search?q=DEFINE_TEXT_PROTO_FUZZER+OR+DEFINE_PROTO_FUZZER+OR+DEFINE_BINARY_PROTO_FUZZER&unscoped_q=DEFINE_TEXT_PROTO_FUZZER+OR+DEFINE_PROTO_FUZZER+OR+DEFINE_BINARY_PROTO_FUZZER&type=Code)