From: Matt Morehouse Date: Fri, 2 Feb 2018 20:22:20 +0000 (+0000) Subject: [clang-proto-to-cxx] Accept protobufs with missing fields. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fea5007e11197e02959e9ec135098e9fe56e2c9c;p=clang [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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324132 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.cpp b/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.cpp index cd75e0c99c..4a86515f55 100644 --- a/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.cpp +++ b/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.cpp @@ -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); }