This is an archive of the discontinued LLVM Phabricator instance.

Introducing single for loop into clang_proto_fuzzer
ClosedPublic

Authored by emmettneyman on Jun 6 2018, 1:23 PM.

Details

Summary

Created a new protobuf and protobuf-to-C++ "converter" that wraps the entire C++ code in a single for loop.

  • Slightly changed cxx_proto.proto -> cxx_loop_proto.proto
  • Made some changes to proto_to_cxx files to handle the new kind of protobuf
  • Created ExampleClangLoopProtoFuzzer to test new protobuf and "converter"

Patch by Emmett Neyman

Diff Detail

Repository
rL LLVM

Event Timeline

emmettneyman created this revision.Jun 6 2018, 1:23 PM

Took out typo'd comment

vitalybuka requested changes to this revision.Jun 6 2018, 1:44 PM
vitalybuka added inline comments.
tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.cpp
23 ↗(On Diff #150192)

I guess you already committed this patch.
Could you please try rebase to upstream, e.g. "git pull -r" and re-upload the review

This revision now requires changes to proceed.Jun 6 2018, 1:44 PM

This contains changes from previous patch. Please rebase.

Hopefully rebased correctly.

morehouse added inline comments.Jun 6 2018, 3:32 PM
tools/clang-fuzzer/cxx_loop_proto.proto
93 ↗(On Diff #150200)

Maybe call this LoopFunction to distinguish from the other protobuf.

tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.cpp
14 ↗(On Diff #150200)

Nit: Try not to introduce whitespace at end of lines. Depending on your configuration, this causes git to complain.

tools/clang-fuzzer/proto-to-cxx/loop_proto_to_cxx.cpp
115 ↗(On Diff #150200)

Right now this file duplicates a lot of code from proto_to_cxx.cpp. But assuming this file will continue to diverge from proto_to_cxx.cpp, I'm fine with the duplication for now.

tools/clang-fuzzer/proto-to-cxx/loop_proto_to_cxx.h
22 ↗(On Diff #150200)

Instead of making a whole new header for this, can we simply add LoopProtoToCxx() and LoopFunctionToString() to proto_to_cxx.h? Then implement them in loop_proto_to_cxx.cpp?

emmettneyman updated this revision to Diff 150213.EditedJun 6 2018, 3:55 PM
  • Combined two header files into one
  • Also renamed protobuf to LoopFunction
morehouse added inline comments.Jun 6 2018, 4:12 PM
tools/clang-fuzzer/CMakeLists.txt
28 ↗(On Diff #150213)

I think it makes sense to use separate SRCS and HDRS variables for cxx_loop_proto.proto. Otherwise each proto-fuzzer will be compiled with both protobufs even though each only uses one.

58 ↗(On Diff #150213)

Why is this here twice?

90 ↗(On Diff #150213)

Maybe you can cut down on some LOC here by creating a COMMON_PROTO_FUZZ_LIBRARIES variable with the dependencies that overlap between the proto-fuzzers.

tools/clang-fuzzer/proto-to-cxx/loop_proto_to_cxx.h
22 ↗(On Diff #150200)

Can we remove this file completely?

  • refactored cmake and deleted header file
morehouse accepted this revision.Jun 7 2018, 11:16 AM
vitalybuka accepted this revision.Jun 7 2018, 11:59 AM
This revision is now accepted and ready to land.Jun 7 2018, 11:59 AM
vitalybuka edited the summary of this revision. (Show Details)Jun 7 2018, 12:00 PM

git clang-format -f --style=file HEAD^

vitalybuka accepted this revision.Jun 7 2018, 12:13 PM
This revision was automatically updated to reflect the committed changes.