Index: test/cctest/test-strings.cc |
diff --git a/test/cctest/test-strings.cc b/test/cctest/test-strings.cc |
index 0f37c3e5172d659bc249675ea5d8d829be3226ba..8e63cb0d4716593da925135014244e8c96f43ada 100644 |
--- a/test/cctest/test-strings.cc |
+++ b/test/cctest/test-strings.cc |
@@ -1275,6 +1275,23 @@ TEST(RobustSubStringStub) { |
} |
+TEST(RegExpOverflow) { |
+ // Result string has the length 2^32, causing a 32-bit integer overflow. |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
+ LocalContext context; |
+ v8::V8::IgnoreOutOfMemoryException(); |
+ v8::Local<v8::Value> result = CompileRun( |
+ "var a = 'a'; " |
+ "for (var i = 0; i < 16; i++) { " |
+ " a += a; " |
+ "} " |
+ "a.replace(/a/g, a); "); |
+ CHECK(result.IsEmpty()); |
+ CHECK(context->HasOutOfMemoryException()); |
+} |
+ |
+ |
TEST(StringReplaceAtomTwoByteResult) { |
CcTest::InitializeVM(); |
v8::HandleScope scope(CcTest::isolate()); |