diff options
author | Jon Skeet <jonskeet@google.com> | 2015-11-05 19:44:26 +0000 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2015-11-05 19:44:26 +0000 |
commit | 6fa17e759737e3225c6cc4ba830b921428c50781 (patch) | |
tree | ea934e5609107db7ce98dda39aa664839d3afb94 /csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs | |
parent | 3d257a9dc1427acf163603cea95fb015e839bd2b (diff) | |
download | protobuf-6fa17e759737e3225c6cc4ba830b921428c50781.tar.gz protobuf-6fa17e759737e3225c6cc4ba830b921428c50781.tar.bz2 protobuf-6fa17e759737e3225c6cc4ba830b921428c50781.zip |
Reimplement JSON recursion by detecting the depth in the tokenizer.
Added a TODO around a possible change to the tokenizer API, changing PushBack(token) into just Rewind() or something similar.
Diffstat (limited to 'csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs')
-rw-r--r-- | csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs b/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs index 01d55395..cacda648 100644 --- a/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs +++ b/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs @@ -95,6 +95,13 @@ namespace Google.Protobuf "Use CodedInputStream.SetRecursionLimit() to increase the depth limit.");
}
+ internal static InvalidProtocolBufferException JsonRecursionLimitExceeded()
+ {
+ return new InvalidProtocolBufferException(
+ "Protocol message had too many levels of nesting. May be malicious. " +
+ "Use JsonParser.Settings to increase the depth limit.");
+ }
+
internal static InvalidProtocolBufferException SizeLimitExceeded()
{
return new InvalidProtocolBufferException(
|