aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/any.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/any.cc')
-rw-r--r--src/google/protobuf/any.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/google/protobuf/any.cc b/src/google/protobuf/any.cc
index 7351d377..f3ca06bf 100644
--- a/src/google/protobuf/any.cc
+++ b/src/google/protobuf/any.cc
@@ -65,9 +65,16 @@ bool AnyMetadata::UnpackTo(Message* message) const {
}
bool AnyMetadata::InternalIs(const Descriptor* descriptor) const {
- return type_url_->GetNoArena(
- &::google::protobuf::internal::GetEmptyString()) ==
- GetTypeUrl(descriptor);
+ const string type_url = type_url_->GetNoArena(
+ &::google::protobuf::internal::GetEmptyString());
+ const string full_name = descriptor->full_name();
+ if (type_url.length() < full_name.length()) {
+ return false;
+ }
+ return (0 == type_url.compare(
+ type_url.length() - full_name.length(),
+ full_name.length(),
+ full_name));
}
bool ParseAnyTypeUrl(const string& type_url, string* full_type_name) {