aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2015-11-05 19:44:26 +0000
committerGravatar Jon Skeet <jonskeet@google.com>2015-11-05 19:44:26 +0000
commit6fa17e759737e3225c6cc4ba830b921428c50781 (patch)
treeea934e5609107db7ce98dda39aa664839d3afb94 /csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs
parent3d257a9dc1427acf163603cea95fb015e839bd2b (diff)
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.cs7
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(