Add a conformance test for unmatched start group tag.

PiperOrigin-RevId: 694345563
pull/19180/head
Mike Kruskal 3 weeks ago committed by Copybara-Service
parent a4a1e7f7f5
commit 2177a2e740
  1. 21
      conformance/binary_json_conformance_suite.cc
  2. 2
      conformance/binary_json_conformance_suite.h
  3. 17
      csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs

@ -1367,7 +1367,7 @@ void BinaryAndJsonConformanceSuiteImpl<MessageType>::TestIllegalTags() {
}
template <typename MessageType>
void BinaryAndJsonConformanceSuiteImpl<MessageType>::TestUnmatchedEndGroup() {
void BinaryAndJsonConformanceSuiteImpl<MessageType>::TestUnmatchedGroup() {
ExpectParseFailureForProto(tag(201, WireFormatLite::WIRETYPE_END_GROUP),
"UnmatchedEndGroup", REQUIRED);
ExpectParseFailureForProto(tag(1234, WireFormatLite::WIRETYPE_END_GROUP),
@ -1384,6 +1384,23 @@ void BinaryAndJsonConformanceSuiteImpl<MessageType>::TestUnmatchedEndGroup() {
absl::StrCat(tag(1, WireFormatLite::WIRETYPE_END_GROUP),
len(2, "hello world")),
"UnmatchedEndGroupWithData", REQUIRED);
ExpectParseFailureForProto(tag(201, WireFormatLite::WIRETYPE_START_GROUP),
"UnmatchedStartGroup", REQUIRED);
ExpectParseFailureForProto(tag(1234, WireFormatLite::WIRETYPE_START_GROUP),
"UnmatchedStartGroupUnknown", REQUIRED);
ExpectParseFailureForProto(tag(1, WireFormatLite::WIRETYPE_START_GROUP),
"UnmatchedStartGroupWrongType", REQUIRED);
ExpectParseFailureForProto(
len(18, tag(1234, WireFormatLite::WIRETYPE_START_GROUP)),
"UnmatchedStartGroupNestedLen", REQUIRED);
ExpectParseFailureForProto(
group(201, tag(202, WireFormatLite::WIRETYPE_START_GROUP)),
"UnmatchedStartGroupNested", REQUIRED);
ExpectParseFailureForProto(
absl::StrCat(tag(1, WireFormatLite::WIRETYPE_START_GROUP),
len(2, "hello world")),
"UnmatchedStartGroupWithData", REQUIRED);
}
template <typename MessageType>
@ -1573,7 +1590,7 @@ void BinaryAndJsonConformanceSuiteImpl<MessageType>::RunAllTests() {
}
TestIllegalTags();
TestUnmatchedEndGroup();
TestUnmatchedGroup();
TestUnknownWireType();
int64_t kInt64Min = -9223372036854775808ULL;

@ -143,7 +143,7 @@ class BinaryAndJsonConformanceSuiteImpl {
ConformanceLevel level);
void TestPrematureEOFForType(google::protobuf::FieldDescriptor::Type type);
void TestIllegalTags();
void TestUnmatchedEndGroup();
void TestUnmatchedGroup();
void TestUnknownWireType();
void TestOneofMessage();
void TestUnknownMessage();

@ -1,17 +0,0 @@
#region Copyright notice and license
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#endregion
namespace Google.Protobuf.Reflection;
internal sealed partial class FeatureSetDescriptor
{
// Canonical serialized form of the edition defaults, generated by embed_edition_defaults.
private const string DefaultsBase64 =
"ChMYhAciACoMCAEQAhgCIAMoATACChMY5wciACoMCAIQARgBIAIoATABChMY6AciDAgBEAEYASACKAEwASoAIOYHKOgH";
}
Loading…
Cancel
Save