Reviewers: lrn,

Description:
Fix natives fuzzing: Let the StringIndexOf runtime function
deal with start indexes that are out of range.

Please review this at http://codereview.chromium.org/8762

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/runtime.cc
   M     test/mjsunit/fuzz-natives.js


Index: test/mjsunit/fuzz-natives.js
===================================================================
--- test/mjsunit/fuzz-natives.js        (revision 662)
+++ test/mjsunit/fuzz-natives.js        (working copy)
@@ -106,6 +106,11 @@
    "SetScriptBreakPoint": true,
    "ChangeBreakOnException": true,
    "PrepareStep": true,
+
+  // Calling disable/enable access checks may interfere with the
+  // the rest of the tests.
+  "DisableAccessChecks": true,
+  "EnableAccessChecks": true,

    // These functions should not be callable as runtime functions.
    "NewContext": true,
Index: src/runtime.cc
===================================================================
--- src/runtime.cc      (revision 662)
+++ src/runtime.cc      (working copy)
@@ -1401,6 +1401,7 @@
    uint32_t start_index;
    if (!Array::IndexFromObject(index, &start_index)) return  
Smi::FromInt(-1);

+  RUNTIME_ASSERT(start_index <= static_cast<uint32_t>(sub->length()));
    int position = Runtime::StringMatch(sub, pat, start_index);
    return Smi::FromInt(position);
  }



--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to