r324132 - [clang-proto-to-cxx] Accept protobufs with missing fields.
Matt Morehouse via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 2 12:22:20 PST 2018
Author: morehouse
Date: Fri Feb 2 12:22:20 2018
New Revision: 324132
URL: http://llvm.org/viewvc/llvm-project?rev=324132&view=rev
Log:
[clang-proto-to-cxx] Accept protobufs with missing fields.
libprotobuf-mutator accepts protobufs with missing fields, which means
clang-proto-fuzzer does as well. clang-proto-to-cxx should match this
behavior.
Modified:
cfe/trunk/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.cpp
Modified: cfe/trunk/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.cpp?rev=324132&r1=324131&r2=324132&view=diff
==============================================================================
--- cfe/trunk/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.cpp (original)
+++ cfe/trunk/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.cpp Fri Feb 2 12:22:20 2018
@@ -94,7 +94,7 @@ std::string FunctionToString(const Funct
}
std::string ProtoToCxx(const uint8_t *data, size_t size) {
Function message;
- if (!message.ParseFromArray(data, size))
+ if (!message.ParsePartialFromArray(data, size))
return "#error invalid proto\n";
return FunctionToString(message);
}
More information about the cfe-commits
mailing list