From f2fe50bfc516cdab99f51fa2ca90ba0db1ef6637 Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Wed, 13 Jan 2016 14:05:06 +0000 Subject: JSON conformance test fixes - Spot an Any without a type URL - In the conformance test runner, catch exceptions due to generally-invalid JSON --- csharp/src/Google.Protobuf/JsonParser.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'csharp/src/Google.Protobuf/JsonParser.cs') 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 -- cgit v1.2.3