JavaScriptCore:
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Nov 2007 00:22:49 +0000 (00:22 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Nov 2007 00:22:49 +0000 (00:22 +0000)
        Reviewed by Sam.

        - http://bugs.webkit.org/show_bug.cgi?id=15951
          REGRESSION: assertion failure in regexp match() when running JS tests

        Test: fast/js/regexp-many-brackets.html

        * pcre/pcre_exec.cpp: (match): Added back accidentally-removed case for
        the BRANUMBER opcode.

LayoutTests:

        Reviewed by Sam.

        - test for http://bugs.webkit.org/show_bug.cgi?id=15951
          REGRESSION: assertion failure in regexp match() when running JS tests

        * fast/js/regexp-many-brackets-expected.txt: Added.
        * fast/js/regexp-many-brackets.html: Added.
        * fast/js/resources/regexp-many-brackets.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27733 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/pcre/pcre_exec.cpp
LayoutTests/ChangeLog
LayoutTests/fast/js/regexp-many-brackets-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/regexp-many-brackets.html [new file with mode: 0644]
LayoutTests/fast/js/resources/regexp-many-brackets.js [new file with mode: 0644]

index 88570c7a3b24a744c8b3956d36dc1e965bc30401..f756bc6dfce6c608dbf4d7c3fbc863c98f8cee68 100644 (file)
@@ -1,3 +1,15 @@
+2007-11-12  Darin Adler  <darin@apple.com>
+
+        Reviewed by Sam.
+
+        - http://bugs.webkit.org/show_bug.cgi?id=15951
+          REGRESSION: assertion failure in regexp match() when running JS tests
+
+        Test: fast/js/regexp-many-brackets.html
+
+        * pcre/pcre_exec.cpp: (match): Added back accidentally-removed case for
+        the BRANUMBER opcode.
+
 2007-11-12  Darin Adler  <darin@apple.com>
 
         Reviewed by Geoff.
index 00cc8877b0828cb0d304f1f456c051982280f62f..6069c576652f6bbdbf6b2b834704b69c6875e60b 100644 (file)
@@ -446,6 +446,12 @@ for (;;)
     DPRINTF(("bracket 0 failed\n"));
     RRETURN;
 
+    /* Skip over large extraction number data if encountered. */
+
+    BEGIN_OPCODE(BRANUMBER):
+    frame->ecode += 3;
+    NEXT_OPCODE;
+
     /* End of the pattern. */
 
     BEGIN_OPCODE(END):
@@ -1852,7 +1858,6 @@ for (;;)
       }
     /* Control never gets here */
 
-    BEGIN_OPCODE(BRANUMBER):
     BEGIN_OPCODE(CRMINPLUS):
     BEGIN_OPCODE(CRMINQUERY):
     BEGIN_OPCODE(CRMINRANGE):
index 77cf09abc1e74214861b66cbcbea4c759359091d..df2d6abe488e7bee8d16d551e21b1e24e2a82523 100644 (file)
@@ -1,3 +1,14 @@
+2007-11-12  Darin Adler  <darin@apple.com>
+
+        Reviewed by Sam.
+
+        - test for http://bugs.webkit.org/show_bug.cgi?id=15951
+          REGRESSION: assertion failure in regexp match() when running JS tests
+
+        * fast/js/regexp-many-brackets-expected.txt: Added.
+        * fast/js/regexp-many-brackets.html: Added.
+        * fast/js/resources/regexp-many-brackets.js: Added.
+
 2007-11-12  Geoffrey Garen  <ggaren@apple.com>
 
         Rubber-stamped by Oliver Hunt.
diff --git a/LayoutTests/fast/js/regexp-many-brackets-expected.txt b/LayoutTests/fast/js/regexp-many-brackets-expected.txt
new file mode 100644 (file)
index 0000000..c4f222d
--- /dev/null
@@ -0,0 +1,11 @@
+Test regular expression processing with many capturing brackets (200).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'hello'.match(manyBracketsRegExp) is manyHellosArray
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/js/regexp-many-brackets.html b/LayoutTests/fast/js/regexp-many-brackets.html
new file mode 100644 (file)
index 0000000..d324c73
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="resources/js-test-style.css">
+<script src="resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/regexp-many-brackets.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/js/resources/regexp-many-brackets.js b/LayoutTests/fast/js/resources/regexp-many-brackets.js
new file mode 100644 (file)
index 0000000..43a8b06
--- /dev/null
@@ -0,0 +1,23 @@
+description(
+'Test regular expression processing with many capturing brackets (200).'
+);
+
+var count = 200;
+
+var regexp = "";
+for (var i = 0; i < count; ++i)
+    regexp += "(";
+regexp += "hello";
+for (var i = 0; i < count; ++i)
+    regexp += ")";
+
+var manyHellosArray = new Array;
+for (var i = 0; i <= count; ++i)
+    manyHellosArray[i] = "hello";
+
+var manyBracketsRegExp = new RegExp(regexp);
+shouldBe("'hello'.match(manyBracketsRegExp)", "manyHellosArray");
+
+debug('');
+
+var successfullyParsed = true;