JavaScriptCore:
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Nov 2007 00:50:36 +0000 (00:50 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Nov 2007 00:50:36 +0000 (00:50 +0000)
        Reviewed by Mitz.

        - fix http://bugs.webkit.org/show_bug.cgi?id=16096
          REGRESSION (r26653-r26699): Plaxo.com addressbook does not load in webkit nightlies

        Test: fast/js/regexp-overflow.html

        * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags):
        Removed a stray "ptr++" that I added by accident when merging the
        changes between PCRE 6.4 and 6.5.

LayoutTests:

        Reviewed by Mitz.

        - test for http://bugs.webkit.org/show_bug.cgi?id=16096
          REGRESSION (r26653-r26699): Plaxo.com addressbook does not load in webkit nightlies

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

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

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

index 906ca10..fa89d6c 100644 (file)
@@ -1,3 +1,16 @@
+2007-11-26  Darin Adler  <darin@apple.com>
+
+        Reviewed by Mitz.
+
+        - fix http://bugs.webkit.org/show_bug.cgi?id=16096
+          REGRESSION (r26653-r26699): Plaxo.com addressbook does not load in webkit nightlies
+
+        Test: fast/js/regexp-overflow.html
+
+        * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags):
+        Removed a stray "ptr++" that I added by accident when merging the
+        changes between PCRE 6.4 and 6.5. 
+
 2007-11-26  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Kevin McCullough.
index 763b019..0c0ffa1 100644 (file)
@@ -2499,8 +2499,8 @@ static int calculateCompiledPatternLengthAndFlags(const pcre_char* pattern, int
                             (min == 1 && max == -1))
                             length++;
                         else length += 5;
-                        if (ptr[1] == '?') ptr++;
-                        ptr++;
+                        if (ptr[1] == '?')
+                            ptr++;
                     }
                 }
                 continue;
index ee9995c..8395eea 100644 (file)
@@ -1,3 +1,14 @@
+2007-11-26  Darin Adler  <darin@apple.com>
+
+        Reviewed by Mitz.
+
+        - test for http://bugs.webkit.org/show_bug.cgi?id=16096
+          REGRESSION (r26653-r26699): Plaxo.com addressbook does not load in webkit nightlies
+
+        * fast/js/regexp-overflow-expected.txt: Added.
+        * fast/js/regexp-overflow.html: Added.
+        * fast/js/resources/regexp-overflow.js: Added.
+
 2007-11-26  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Darin.
diff --git a/LayoutTests/fast/js/regexp-overflow-expected.txt b/LayoutTests/fast/js/regexp-overflow-expected.txt
new file mode 100644 (file)
index 0000000..896ca34
--- /dev/null
@@ -0,0 +1,13 @@
+Tests some regular expressions with braces in them that used to overflow the regular expression compilation preflight computation.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS /(\d)(\1{1})/.exec("11").toString() is "11,1,1"
+PASS /^(\d{1,2})([ -:\/\.]{1})(\d{1,2})(\2{1})?(\d{2,4})?$/.exec("1:1").toString() is "1:1,1,:,1,,"
+PASS /^(\d{4})([ -:\/\.]{1})(\d{1,2})(\2{1})(\d{1,2})T(\d{1,2})([ -:\/\.]{1})(\d{1,2})(\7{1})(\d{1,2})Z$/.exec("1234:5:6T7/8/9Z").toString() is "1234:5:6T7/8/9Z,1234,:,5,:,6,7,/,8,/,9"
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/js/regexp-overflow.html b/LayoutTests/fast/js/regexp-overflow.html
new file mode 100644 (file)
index 0000000..d593d4e
--- /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-overflow.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/js/resources/regexp-overflow.js b/LayoutTests/fast/js/resources/regexp-overflow.js
new file mode 100644 (file)
index 0000000..3cb4907
--- /dev/null
@@ -0,0 +1,11 @@
+description(
+'Tests some regular expressions with braces in them that used to overflow the regular expression compilation preflight computation.'
+);
+
+shouldBe('/(\\d)(\\1{1})/.exec("11").toString()', '"11,1,1"');
+shouldBe('/^(\\d{1,2})([ -:\\/\\.]{1})(\\d{1,2})(\\2{1})?(\\d{2,4})?$/.exec("1:1").toString()', '"1:1,1,:,1,,"');
+shouldBe('/^(\\d{4})([ -:\\/\\.]{1})(\\d{1,2})(\\2{1})(\\d{1,2})T(\\d{1,2})([ -:\\/\\.]{1})(\\d{1,2})(\\7{1})(\\d{1,2})Z$/.exec("1234:5:6T7/8/9Z").toString()', '"1234:5:6T7/8/9Z,1234,:,5,:,6,7,/,8,/,9"');
+
+debug('');
+
+var successfullyParsed = true;