New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fuzz: libprotobuf-mutator integration. #3139
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
19214f9
fuzz: libprotobuf-mutator integration.
htuch 7425f03
Simplify BUILD with globs.
htuch e05c021
Skip on OS X.
htuch e1e39a5
Another approach to excluding OS X.
htuch fb09d71
Merge remote-tracking branch 'upstream/master' into libprotobuf-mutator
htuch 7894a46
More OS X hackery.
htuch File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cc_library( | ||
name = "libprotobuf_mutator", | ||
srcs = glob(["src/**/*.cc", "src/**/*.h", "port/protobuf.h"], exclude=["**/*_test.cc"]), | ||
hdrs = ["src/libfuzzer/libfuzzer_macro.h"], | ||
includes = ["."], | ||
include_prefix = "libprotobuf_mutator", | ||
deps = ["//external:protobuf"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
string_value: "foo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
struct_value { | ||
fields { | ||
key: "null" | ||
value { | ||
null_value: NULL_VALUE | ||
} | ||
} | ||
fields { | ||
key: "number" | ||
value { | ||
number_value: 3.14159265358979323 | ||
} | ||
} | ||
fields { | ||
key: "string" | ||
value { | ||
string_value: "string" | ||
} | ||
} | ||
fields { | ||
key: "bool" | ||
value { | ||
bool_value: true | ||
} | ||
} | ||
fields { | ||
key: "list" | ||
value { | ||
list_value { | ||
values { | ||
string_value: "some" | ||
} | ||
values { | ||
string_value: "thing" | ||
} | ||
} | ||
} | ||
} | ||
fields { | ||
key: "struct" | ||
value { | ||
struct_value { | ||
fields { | ||
key: "foo" | ||
value { | ||
number_value: 42 | ||
} | ||
} | ||
fields { | ||
key: "bar" | ||
value { | ||
number_value: 37 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "common/protobuf/utility.h" | ||
|
||
#include "test/fuzz/fuzz_runner.h" | ||
|
||
namespace Envoy { | ||
namespace Fuzz { | ||
|
||
DEFINE_PROTO_FUZZER(const ProtobufWkt::Value& input) { ValueUtil::equal(input, input); } | ||
|
||
} // namespace Fuzz | ||
} // namespace Envoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Dummy main implementation for nooping tests. | ||
// TODO(htuch): remove when we have a solution for | ||
// https://github.com/bazelbuild/bazel/issues/3510 | ||
|
||
// NOLINT(namespace-envoy) | ||
int main(int /*argc*/, char** /*argv*/) { return 0; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmillikin-stripe I'm not super happy with how this turned out, I don't like non-trivial BUILD files in Envoy, but this was simplest vs. getting protobuf as a Bazel dep and the cmake build system to play nice. I've filed google/libprotobuf-mutator#91 to request that we get proper upstream Bazel support for this project. I think the current solution is fine as this is a test-only dependency and it's a pretty simple library, we don't care about tests in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be able to simplify this with globs:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmillikin-stripe can you take another look at what I've done for OS X? I'm not very happy with it, I would like something more like bazelbuild/bazel#3510.