Fix external snapshot reading by removing an assumption that strings in the snapshot file are null-terminated.

R=vogelheim@chromium.org

Review URL: https://codereview.chromium.org/496253003

Patch from André Baixo <baixo@google.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23416 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
rmcilroy@chromium.org 2014-08-26 16:56:49 +00:00
parent b250a99031
commit defea14cfb

View File

@ -34,7 +34,9 @@ class NativesStore {
int GetIndex(const char* name) {
for (int i = 0; i < native_names_.length(); ++i) {
if (strcmp(name, native_names_[i].start()) == 0) {
int native_name_length = native_names_[i].length();
if ((static_cast<int>(strlen(name)) == native_name_length) &&
(strncmp(name, native_names_[i].start(), native_name_length) == 0)) {
return i;
}
}