Skip to content

Commit 90282ba

Browse files
authored
Update README (#230)
* Add syntax highlight to snippets in README * Add a section with grammars in protobuf format to the README
1 parent 50ae177 commit 90282ba

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

README.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ It could be used together with guided fuzzing engines, such as [libFuzzer](http:
1212

1313
Install prerequisites:
1414

15-
```
15+
```sh
1616
sudo apt-get update
1717
sudo apt-get install protobuf-compiler libprotobuf-dev binutils cmake \
1818
ninja-build liblzma-dev libz-dev pkg-config autoconf libtool
1919
```
2020

2121
Compile and test everything:
2222

23-
```
23+
```sh
2424
mkdir build
2525
cd build
2626
cmake .. -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug
@@ -36,7 +36,7 @@ build a working version of protobuf.
3636

3737
Installation:
3838

39-
```
39+
```sh
4040
ninja
4141
sudo ninja install
4242
```
@@ -59,7 +59,7 @@ using [libFuzzer](http://libfuzzer.info)'s mutators.
5959

6060
To apply one mutation to a protobuf object do the following:
6161

62-
```
62+
```c++
6363
class MyProtobufMutator : public protobuf_mutator::Mutator {
6464
public:
6565
// Optionally redefine the Mutate* methods to perform more sophisticated mutations.
@@ -77,7 +77,7 @@ See also the `ProtobufMutatorMessagesTest.UsageExample` test from
7777
## Integrating with libFuzzer
7878
LibFuzzerProtobufMutator can help to integrate with libFuzzer. For example
7979
80-
```
80+
```c++
8181
#include "src/libfuzzer/libfuzzer_macro.h"
8282
8383
DEFINE_PROTO_FUZZER(const MyMessageType& input) {
@@ -97,7 +97,7 @@ for fuzzer even if it's capable of inserting acceptable values with time.
9797
PostProcessorRegistration can be used to avoid such issue and guide your fuzzer towards interesting
9898
code. It registers callback which will be called for each message of particular type after each mutation.
9999

100-
```
100+
```c++
101101
static protobuf_mutator::libfuzzer::PostProcessorRegistration<MyMessageType> reg = {
102102
[](MyMessageType* message, unsigned int seed) {
103103
TweakMyMessage(message, seed);
@@ -117,7 +117,7 @@ may corrupt the reproducer so it stops triggering the bug.
117117

118118
Note: You can add callback for any nested message and you can add multiple callbacks for
119119
the same message type.
120-
```
120+
```c++
121121
static PostProcessorRegistration<MyMessageType> reg1 = {
122122
[](MyMessageType* message, unsigned int seed) {
123123
TweakMyMessage(message, seed);
@@ -155,6 +155,24 @@ cleanup/initialize the message as workaround.
155155
* [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)
156156
* [LLVM](https://github.com/llvm-mirror/clang/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)
157157

158+
## Grammars
159+
* GIF, https://github.com/google/oss-fuzz/tree/master/projects/giflib
160+
* JSON
161+
* https://github.com/google/oss-fuzz/tree/master/projects/jsoncpp
162+
* https://github.com/officialcjunior/fuzzrtos/tree/c72e6670e566672ccf8023265cbfad616e75790d/protobufv2
163+
* Lua 5.1 Language,
164+
* https://github.com/ligurio/lua-c-api-tests/tree/master/tests/luaL_loadbuffer_proto
165+
* https://github.com/Spoookyyy/luaj/tree/main/fuzz
166+
* PNG, https://github.com/google/oss-fuzz/tree/master/projects/libpng-proto
167+
* SQL
168+
* https://github.com/tarantool/tarantool/tree/master/test/fuzz/sql_fuzzer
169+
* https://chromium.googlesource.com/chromium/src/third_party/+/refs/heads/main/sqlite/fuzz
170+
* Solidity Language, https://github.com/ethereum/solidity/tree/develop/test/tools/ossfuzz
171+
* XML
172+
* https://github.com/google/oss-fuzz/tree/master/projects/xerces-c
173+
* https://github.com/google/libprotobuf-mutator/tree/master/examples/xml
174+
* JPEG, https://source.chromium.org/chromium/chromium/src/+/main:media/gpu/vaapi/fuzzers/jpeg_decoder/
175+
158176
## Bugs found with help of the library
159177

160178
### Chromium

0 commit comments

Comments
 (0)