]> granicus.if.org Git - clang/commitdiff
[clang-proto-to-cxx] Accept protobufs with missing fields.
authorMatt Morehouse <mascasa@google.com>
Fri, 2 Feb 2018 20:22:20 +0000 (20:22 +0000)
committerMatt Morehouse <mascasa@google.com>
Fri, 2 Feb 2018 20:22:20 +0000 (20:22 +0000)
libprotobuf-mutator accepts protobufs with missing fields, which means
clang-proto-fuzzer does as well.  clang-proto-to-cxx should match this
behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324132 91177308-0d34-0410-b5e6-96231b3b80d8

tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.cpp

index cd75e0c99c47aa494a14aa065e432b62cf940570..4a86515f559861a21104e60ce621bf106b1da460 100644 (file)
@@ -94,7 +94,7 @@ std::string FunctionToString(const Function &input) {
 }
 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);
 }