Index: test/cctest/test-strings.cc |
diff --git a/test/cctest/test-strings.cc b/test/cctest/test-strings.cc |
index e2a179f9324d2375da2ee5a78ac9378f83086aee..8c4442c432246f1e0f3e8a1306b8bfbe0a4875aa 100644 |
--- a/test/cctest/test-strings.cc |
+++ b/test/cctest/test-strings.cc |
@@ -620,3 +620,16 @@ TEST(AsciiArrayJoin) { |
CHECK(result.IsEmpty()); |
CHECK(context->HasOutOfMemoryException()); |
} |
+ |
+ |
+TEST(RobustSubStringStub) { |
+ // This tests whether the SubStringStub can handle unsafe arguments. |
+ // If not recognized, those unsafe arguments lead to out-of-bounds reads. |
+ FLAG_allow_natives_syntax = true; |
+ InitializeVM(); |
+ HandleScope scope; |
+ v8::Local<v8::Value> result; |
+ Handle<String> string; |
+ CompileRun("%_SubString('abcdef', 0, 10000)"); |
+ CompileRun("%_SubString('abcdef', 5, 2)"); |
Erik Corry
2012/04/17 09:06:58
I'd like more tests here. Negative numbers, borde
|
+} |