2010-09-30 Peter Varga <pvarga@inf.u-szeged.hu>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Sep 2010 11:44:52 +0000 (11:44 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Sep 2010 11:44:52 +0000 (11:44 +0000)
        Reviewed by Gavin Barraclough.

        The case-insensitivity backreference checking isn't working with YARR
        Interpreter
        https://bugs.webkit.org/show_bug.cgi?id=46882

        Add ignorecase checking to the Interpreter::tryConsumeBackReference() function.

        * yarr/RegexInterpreter.cpp:
        (JSC::Yarr::Interpreter::tryConsumeBackReference):

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

JavaScriptCore/ChangeLog
JavaScriptCore/yarr/RegexInterpreter.cpp

index 547d2e5..e793955 100644 (file)
@@ -1,3 +1,16 @@
+2010-09-30  Peter Varga  <pvarga@inf.u-szeged.hu>
+
+        Reviewed by Gavin Barraclough.
+
+        The case-insensitivity backreference checking isn't working with YARR
+        Interpreter
+        https://bugs.webkit.org/show_bug.cgi?id=46882
+
+        Add ignorecase checking to the Interpreter::tryConsumeBackReference() function.
+
+        * yarr/RegexInterpreter.cpp:
+        (JSC::Yarr::Interpreter::tryConsumeBackReference):
+
 2010-09-30  Kwang Yul Seo  <skyul@company100.net>
 
         Reviewed by Andreas Kling.
index 17ffd8f..1b3f620 100644 (file)
@@ -313,10 +313,24 @@ public:
         if (!input.checkInput(matchSize))
             return false;
 
-        for (int i = 0; i < matchSize; ++i) {
-            if (!checkCharacter(input.reread(matchBegin + i), inputOffset - matchSize + i)) {
-                input.uncheckInput(matchSize);
-                return false;
+        if (pattern->m_ignoreCase) {
+            for (int i = 0; i < matchSize; ++i) {
+                int ch = input.reread(matchBegin + i);
+
+                int lo = Unicode::toLower(ch);
+                int hi = Unicode::toUpper(ch);
+
+                if ((lo != hi) ? (!checkCasedCharacter(lo, hi, inputOffset - matchSize + i)) : (!checkCharacter(ch, inputOffset - matchSize + i))) {
+                    input.uncheckInput(matchSize);
+                    return false;
+                }
+            }
+        } else {
+            for (int i = 0; i < matchSize; ++i) {
+                if (!checkCharacter(input.reread(matchBegin + i), inputOffset - matchSize + i)) {
+                    input.uncheckInput(matchSize);
+                    return false;
+                }
             }
         }