diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index 1619d34daa..fda5dc4d7a 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -7394,21 +7394,13 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, field->number()); if (extension_range == nullptr) { - // Set of valid extension numbers for MessageSet is different (< 2^32) - // from other extendees (< 2^29). If unknown deps are allowed, we may not - // have that information, and wrongly deem the extension as invalid. - auto skip_check = get_allow_unknown(pool_) && - absl::StripPrefix(proto.extendee(), ".") == - "google.protobuf.bridge.MessageSet"; - if (!skip_check) { - AddError(field->full_name(), proto, - DescriptorPool::ErrorCollector::NUMBER, [&] { - return absl::Substitute( - "\"$0\" does not declare $1 as an " - "extension number.", - field->containing_type()->full_name(), field->number()); - }); - } + AddError(field->full_name(), proto, + DescriptorPool::ErrorCollector::NUMBER, [&] { + return absl::Substitute( + "\"$0\" does not declare $1 as an " + "extension number.", + field->containing_type()->full_name(), field->number()); + }); } } diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc index 9eb7011acd..3529aca8f9 100644 --- a/src/google/protobuf/descriptor_unittest.cc +++ b/src/google/protobuf/descriptor_unittest.cc @@ -3222,6 +3222,7 @@ TEST_P(AllowUnknownDependenciesTest, UnknownExtendee) { extendee->extension_range(0)->end_number()); } + TEST_P(AllowUnknownDependenciesTest, CustomOption) { // Test that we can use a custom option without having parsed // descriptor.proto.