Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: src/profile-generator.cc

Issue 8509003: Limit length of strings copied into a heap snapshot (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/profile-generator.h ('K') | « src/profile-generator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index 7760d8f90e46feb65b8f2ab3c7a615c12bb93aa1..09b8b340bce2794c88c374eabec1e09b81c55b7e 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -148,11 +148,16 @@ const char* StringsStorage::GetVFormatted(const char* format, va_list args) {
}
+const uint32_t StringsStorage::kMaxNameSize = 1024;
+
const char* StringsStorage::GetName(String* name) {
if (name->IsString()) {
- return AddOrDisposeString(
- name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL).Detach(),
- name->Hash());
+ uint32_t length = name->length();
+ length = kMaxNameSize > length ? length : kMaxNameSize;
mnaganov (inactive) 2011/11/09 11:45:23 length = Min(length, kMaxNameSize)
+ SmartArrayPointer<char> data =
+ name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL, 0, length);
+ uint32_t hash = HashSequentialString(*data, length);
+ return AddOrDisposeString(data.Detach(), hash);
}
return "";
}
« src/profile-generator.h ('K') | « src/profile-generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698