Revision: 23416
Author:   [email protected]
Date:     Tue Aug 26 16:56:49 2014 UTC
Log: Fix external snapshot reading by removing an assumption that strings in the snapshot file are null-terminated.

[email protected]

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

Patch from AndrĂ© Baixo <[email protected]>.
https://code.google.com/p/v8/source/detail?r=23416

Modified:
 /branches/bleeding_edge/src/natives-external.cc

=======================================
--- /branches/bleeding_edge/src/natives-external.cc Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/natives-external.cc Tue Aug 26 16:56:49 2014 UTC
@@ -34,7 +34,9 @@

   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;
       }
     }

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to