aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf/JsonParser.cs
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2016-01-13 14:05:06 +0000
committerGravatar Jon Skeet <jonskeet@google.com>2016-01-13 14:05:06 +0000
commitf2fe50bfc516cdab99f51fa2ca90ba0db1ef6637 (patch)
treee127cc82f34cdd3b8a65c39249d5a49b608f3131 /csharp/src/Google.Protobuf/JsonParser.cs
parent73c003c309235485c0e53f2075242567c88a72bc (diff)
JSON conformance test fixes
- Spot an Any without a type URL - In the conformance test runner, catch exceptions due to generally-invalid JSON
Diffstat (limited to 'csharp/src/Google.Protobuf/JsonParser.cs')
-rw-r--r--csharp/src/Google.Protobuf/JsonParser.cs5
1 files changed, 5 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/JsonParser.cs b/csharp/src/Google.Protobuf/JsonParser.cs
index 300a66b4..f7ebd057 100644
--- a/csharp/src/Google.Protobuf/JsonParser.cs
+++ b/csharp/src/Google.Protobuf/JsonParser.cs
@@ -464,6 +464,11 @@ namespace Google.Protobuf
{
tokens.Add(token);
token = tokenizer.Next();
+
+ if (tokenizer.ObjectDepth < typeUrlObjectDepth)
+ {
+ throw new InvalidProtocolBufferException("Any message with no @type");
+ }
}
// Don't add the @type property or its value to the recorded token list