diff --git a/conformance/binary_json_conformance_suite.cc b/conformance/binary_json_conformance_suite.cc index 543919ae8d..1399611748 100644 --- a/conformance/binary_json_conformance_suite.cc +++ b/conformance/binary_json_conformance_suite.cc @@ -1366,6 +1366,26 @@ void BinaryAndJsonConformanceSuiteImpl::TestIllegalTags() { } } +template +void BinaryAndJsonConformanceSuiteImpl::TestUnmatchedEndGroup() { + ExpectParseFailureForProto(tag(201, WireFormatLite::WIRETYPE_END_GROUP), + "UnmatchedEndGroup", REQUIRED); + ExpectParseFailureForProto(tag(1234, WireFormatLite::WIRETYPE_END_GROUP), + "UnmatchedEndGroupUnknown", REQUIRED); + ExpectParseFailureForProto(tag(1, WireFormatLite::WIRETYPE_END_GROUP), + "UnmatchedEndGroupWrongType", REQUIRED); + ExpectParseFailureForProto( + len(18, tag(1234, WireFormatLite::WIRETYPE_END_GROUP)), + "UnmatchedEndGroupNestedLen", REQUIRED); + ExpectParseFailureForProto( + group(201, tag(202, WireFormatLite::WIRETYPE_END_GROUP)), + "UnmatchedEndGroupNested", REQUIRED); + ExpectParseFailureForProto( + absl::StrCat(tag(1, WireFormatLite::WIRETYPE_END_GROUP), + len(2, "hello world")), + "UnmatchedEndGroupWithData", REQUIRED); +} + template void BinaryAndJsonConformanceSuiteImpl::TestUnknownWireType() { for (uint8_t type : {0x6, 0x7}) { @@ -1553,7 +1573,7 @@ void BinaryAndJsonConformanceSuiteImpl::RunAllTests() { } TestIllegalTags(); - + TestUnmatchedEndGroup(); TestUnknownWireType(); int64_t kInt64Min = -9223372036854775808ULL; diff --git a/conformance/binary_json_conformance_suite.h b/conformance/binary_json_conformance_suite.h index 325a76e3ba..3166eb4897 100644 --- a/conformance/binary_json_conformance_suite.h +++ b/conformance/binary_json_conformance_suite.h @@ -143,6 +143,7 @@ class BinaryAndJsonConformanceSuiteImpl { ConformanceLevel level); void TestPrematureEOFForType(google::protobuf::FieldDescriptor::Type type); void TestIllegalTags(); + void TestUnmatchedEndGroup(); void TestUnknownWireType(); void TestOneofMessage(); void TestUnknownMessage(); diff --git a/conformance/failure_list_java.txt b/conformance/failure_list_java.txt index 9e2e525568..f4547f9f18 100644 --- a/conformance/failure_list_java.txt +++ b/conformance/failure_list_java.txt @@ -43,3 +43,7 @@ Required.*.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool Required.*.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt # Should have failed to parse, but didn't. Required.*.JsonInput.StringFieldNotAString # Should have failed to parse, but didn't. Required.*.ProtobufInput.UnknownOrdering.ProtobufOutput # Unknown field mismatch +Required.*.ProtobufInput.UnmatchedEndGroup # Should have failed to parse, but didn't. +Required.*.ProtobufInput.UnmatchedEndGroupUnknown # Should have failed to parse, but didn't. +Required.*.ProtobufInput.UnmatchedEndGroupWithData # Should have failed to parse, but didn't. +Required.*.ProtobufInput.UnmatchedEndGroupWrongType # Should have failed to parse, but didn't. diff --git a/conformance/failure_list_java_lite.txt b/conformance/failure_list_java_lite.txt index 1494114f08..39a0f21c5c 100644 --- a/conformance/failure_list_java_lite.txt +++ b/conformance/failure_list_java_lite.txt @@ -6,3 +6,7 @@ Required.*.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE # Should have failed to parse, but didn't. Required.*.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE # Should have failed to parse, but didn't. +Required.*.ProtobufInput.UnmatchedEndGroup # Should have failed to parse, but didn't. +Required.*.ProtobufInput.UnmatchedEndGroupUnknown # Should have failed to parse, but didn't. +Required.*.ProtobufInput.UnmatchedEndGroupWithData # Should have failed to parse, but didn't. +Required.*.ProtobufInput.UnmatchedEndGroupWrongType # Should have failed to parse, but didn't. diff --git a/conformance/failure_list_jruby.txt b/conformance/failure_list_jruby.txt index b02f9a5ecf..7eced2560d 100644 --- a/conformance/failure_list_jruby.txt +++ b/conformance/failure_list_jruby.txt @@ -144,3 +144,7 @@ Required.Editions_Proto2.ProtobufInput.UnknownOrdering.ProtobufOutput Required.Editions_Proto3.ProtobufInput.UnknownOrdering.ProtobufOutput Required.Proto2.ProtobufInput.UnknownOrdering.ProtobufOutput Required.Proto3.ProtobufInput.UnknownOrdering.ProtobufOutput +Required.*.ProtobufInput.UnmatchedEndGroup # Should have failed to parse, but didn't. +Required.*.ProtobufInput.UnmatchedEndGroupUnknown # Should have failed to parse, but didn't. +Required.*.ProtobufInput.UnmatchedEndGroupWithData # Should have failed to parse, but didn't. +Required.*.ProtobufInput.UnmatchedEndGroupWrongType # Should have failed to parse, but didn't. diff --git a/conformance/failure_list_python_cpp.txt b/conformance/failure_list_python_cpp.txt index 1a2cc15e85..0826610d87 100644 --- a/conformance/failure_list_python_cpp.txt +++ b/conformance/failure_list_python_cpp.txt @@ -6,5 +6,8 @@ # # TODO: insert links to corresponding bugs tracking the issue. # Should we use GitHub issues or the Google-internal bug tracker? - Required.*.JsonInput.Int32FieldQuotedExponentialValue.* # Failed to parse input or produce output. +Required.*.ProtobufInput.UnmatchedEndGroup # Should have failed to parse, but didn't. +Required.*.ProtobufInput.UnmatchedEndGroupUnknown # Should have failed to parse, but didn't. +Required.*.ProtobufInput.UnmatchedEndGroupWithData # Should have failed to parse, but didn't. +Required.*.ProtobufInput.UnmatchedEndGroupWrongType # Should have failed to parse, but didn't. diff --git a/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs b/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs deleted file mode 100644 index 208ce1fcb6..0000000000 --- a/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs +++ /dev/null @@ -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"; -} diff --git a/python/build_targets.bzl b/python/build_targets.bzl index 49d642eafb..ce1c2624d9 100644 --- a/python/build_targets.bzl +++ b/python/build_targets.bzl @@ -468,7 +468,7 @@ def build_targets(name): conformance_test( name = "conformance_test_cpp", env = {"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": "cpp"}, - failure_list = "//conformance:failure_list_python.txt", + failure_list = "//conformance:failure_list_python_cpp.txt", target_compatible_with = select({ "@system_python//:none": ["@platforms//:incompatible"], ":use_fast_cpp_protos": [],