diff options
author | Vitaly Buka <vitalybuka@google.com> | 2019-02-04 12:42:48 -0800 |
---|---|---|
committer | Vitaly Buka <vitalybuka@gmail.com> | 2019-02-04 12:58:55 -0800 |
commit | 3d1ea5f9eb5fc90f9f8e28447541929482cfb049 (patch) | |
tree | a32e1b1ee81799e607b5a1c3add7a836f8a5dfea /src/text_format.cc | |
parent | f6aba84f7565f10bd0106fe3cd7234104a140fa2 (diff) | |
download | libprotobuf-mutator-3d1ea5f9eb5fc90f9f8e28447541929482cfb049.tar.gz |
Remove workaround for stack overflow
Not needed with protocolbuffers/protobuf#5661
Diffstat (limited to 'src/text_format.cc')
-rw-r--r-- | src/text_format.cc | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/src/text_format.cc b/src/text_format.cc index c67906e..9990d60 100644 --- a/src/text_format.cc +++ b/src/text_format.cc @@ -24,22 +24,8 @@ bool ParseTextMessage(const uint8_t* data, size_t size, Message* output) { return ParseTextMessage({data, data + size}, output); } -// TODO(vitalybuka): Add real check into protobuf::TextFormat and remove this. -static bool IsNestingTooDeep(const std::string& data) { - int i = 101; - for (auto c : data) { - if (c == '{') - --i; - else if (c == '}') - ++i; - if (!i) return true; - } - return false; -} - bool ParseTextMessage(const std::string& data, protobuf::Message* output) { output->Clear(); - if (IsNestingTooDeep(data)) return false; TextFormat::Parser parser; parser.AllowPartialMessage(true); if (!parser.ParseFromString(data, output)) { |