Index: src/profile-generator.cc |
diff --git a/src/profile-generator.cc b/src/profile-generator.cc |
index 7760d8f90e46feb65b8f2ab3c7a615c12bb93aa1..e1813c5ab9edb122da96751bc9bf1f5710f0f05f 100644 |
--- a/src/profile-generator.cc |
+++ b/src/profile-generator.cc |
@@ -150,9 +150,11 @@ const char* StringsStorage::GetVFormatted(const char* format, va_list args) { |
const char* StringsStorage::GetName(String* name) { |
if (name->IsString()) { |
- return AddOrDisposeString( |
- name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL).Detach(), |
- name->Hash()); |
+ int length = Min(kMaxNameSize, name->length()); |
+ SmartArrayPointer<char> data = |
+ name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL, 0, length); |
+ uint32_t hash = HashSequentialString(*data, length); |
+ return AddOrDisposeString(data.Detach(), hash); |
} |
return ""; |
} |