Skip to content

Commit

Permalink
Move libfuzzer_example into examples dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalybuka committed Jan 13, 2017
1 parent 65bf040 commit bc7b24d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ target_link_libraries(protobuf-mutator
enable_testing()
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS src/protobuf_mutator.proto)
add_executable(protobuf_mutator_test
src/protobuf_mutator_test.cc
src/weighted_reservoir_sampler_test.cc
src/protobuf_mutator_test.cc
src/weighted_reservoir_sampler_test.cc
${PROTO_SRCS})
target_link_libraries(protobuf_mutator_test
protobuf-mutator
Expand Down Expand Up @@ -104,9 +104,9 @@ add_custom_target(check
# Examples
if (LIB_PROTO_MUTATOR_HAS_SANITIZE_COVERAGE)
include(libfuzzer)
protobuf_generate_cpp(LIB_FUZZER_PROTO_SRCS LIB_FUZZER_PROTO_HDRS src/libfuzzer_example.proto)
protobuf_generate_cpp(LIB_FUZZER_PROTO_SRCS LIB_FUZZER_PROTO_HDRS examples/libfuzzer.proto)
add_executable(libfuzzer_example
src/libfuzzer_example.cc
examples/libfuzzer.cc
${LIB_FUZZER_PROTO_SRCS})
set_property(TARGET libfuzzer_example
PROPERTY COMPILE_FLAGS "-fsanitize-coverage=trace-pc-guard")
Expand All @@ -116,7 +116,7 @@ if (LIB_PROTO_MUTATOR_HAS_SANITIZE_COVERAGE)
protobuf-mutator
${LIBFUZZER_LIBRARIES})

target_sources(protobuf_mutator_test PRIVATE src/libfuzzer_example_test.cc)
target_sources(protobuf_mutator_test PRIVATE examples/libfuzzer_test.cc)
add_dependencies(protobuf_mutator_test libfuzzer_example)
endif()

Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ See also the `ProtobufMutatorMessagesTest.UsageExample` test from
LibFuzzerProtobufMutator can help to integrate with libFuzzer. For example

```
#include "fuzzing_helpers.h"
#include "libfuzzer_protobuf_mutator.h"
extern "C" size_t LLVMFuzzerCustomMutator(uint8_t* data, size_t size,
size_t max_size, unsigned int seed) {
MyMessageType message;
protobuf_mutator::LibFuzzerProtobufMutator mutator(seed);
return protobuf_mutator::MutateTextMessage(data, size, max_size, &mutator,
return protobuf_mutator::MutateTextMessage(data, size, max_size, seed,
&message);
}
Expand All @@ -80,4 +78,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
```

Please see [libfuzzer_example.cc](/src/libfuzzer_example.cc) as an example.
Please see [libfuzzer.cc](/examples/libfuzzer.cc) as an example.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/field_instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <memory>
#include <string>

#include <google/protobuf/message.h>
#include "google/protobuf/message.h"

namespace protobuf_mutator {

Expand Down

0 comments on commit bc7b24d

Please sign in to comment.