LayoutTests:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 May 2006 06:51:09 +0000 (06:51 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 May 2006 06:51:09 +0000 (06:51 +0000)
        Reviewed by Maciej.

        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8951
          AtomicString hash corrupted by high-bit Latin-1

        * fast/encoding/high-bit-latin1-expected.txt: Added.
        * fast/encoding/high-bit-latin1.html: Added.

WebCore:

        Reviewed by Maciej, tweaked by Darin.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8951
          AtomicString hash corrupted by high-bit Latin-1

        Test: fast/encoding/high-bit-latin1.html

        * platform/AtomicString.cpp: (WebCore::CStringTranslator::equal): Use an
        unsigned char local.
        * platform/StringImpl.cpp: (WebCore::StringImpl::init): Ditto.

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

LayoutTests/ChangeLog
LayoutTests/fast/encoding/high-bit-latin1-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/high-bit-latin1.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/AtomicString.cpp
WebCore/platform/StringImpl.cpp

index a12a3887681c4b6c9f0017167f26d188b2dadeec..ce19f43aaedbd6465343c43affa541a1cf2b690b 100644 (file)
@@ -1,3 +1,13 @@
+2006-05-17  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Maciej.
+
+        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8951
+          AtomicString hash corrupted by high-bit Latin-1
+
+        * fast/encoding/high-bit-latin1-expected.txt: Added.
+        * fast/encoding/high-bit-latin1.html: Added.
+
 2006-05-17  Rob Buis  <buis@kde.org>
 
         Reviewed by Maciej.
diff --git a/LayoutTests/fast/encoding/high-bit-latin1-expected.txt b/LayoutTests/fast/encoding/high-bit-latin1-expected.txt
new file mode 100644 (file)
index 0000000..0755963
--- /dev/null
@@ -0,0 +1,5 @@
+Test Latin-1 conversion to String
+
+PASS
+
+
diff --git a/LayoutTests/fast/encoding/high-bit-latin1.html b/LayoutTests/fast/encoding/high-bit-latin1.html
new file mode 100644 (file)
index 0000000..ba8e6d6
--- /dev/null
@@ -0,0 +1,18 @@
+<html>
+<head>
+    <title></title>
+</head>
+<body>
+    <p>
+        Test Latin-1 conversion to String
+    </p>
+    <a id="t" à></a>
+    <p>
+    <script type="text/javascript">
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+        document.write(document.getElementById("t").attributes[1].name == "\u00e0" ? "PASS" : "FAIL");
+    </script>
+    </p>
+</body>
+</html>
index 443f508e5660808ff44301b999e96cd130ebc402..a9a438675d0bf0aa7da938215685a566e12c1496 100644 (file)
@@ -1,3 +1,16 @@
+2006-05-17  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Maciej, tweaked by Darin.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8951
+          AtomicString hash corrupted by high-bit Latin-1
+
+        Test: fast/encoding/high-bit-latin1.html
+
+        * platform/AtomicString.cpp: (WebCore::CStringTranslator::equal): Use an
+        unsigned char local.
+        * platform/StringImpl.cpp: (WebCore::StringImpl::init): Ditto.
+
 2006-05-17  Rob Buis  <buis@kde.org>
 
         Reviewed by Maciej.
index 2e3b9867dc3e45457888c908fc7b8c030b96b801..90a7cd6e8cb0d24363f6f8787a6fa6edec595bf3 100644 (file)
@@ -52,9 +52,11 @@ struct CStringTranslator
     {
         int length = r->length();
         const UChar* d = r->characters();
-        for (int i = 0; i != length; ++i)
-            if (d[i] != s[i])
+        for (int i = 0; i != length; ++i) {
+            unsigned char c = s[i];
+            if (d[i] != c)
                 return false;
+        }
         return s[length] == 0;
     }
 
index 9c90952791a26cf320d2d9c4b4749de4137f101f..80e3074c7645d7acee6ee559d9bbdba66bcf62b7 100644 (file)
@@ -96,8 +96,10 @@ void StringImpl::init(const char* str, unsigned len)
     m_data = newUCharVector(m_length);
     int i = m_length;
     UChar* ptr = m_data;
-    while (i--)
-        *ptr++ = *str++;
+    while (i--) {
+        unsigned char c = *str++;
+        *ptr++ = c;
+    }
 }
 
 void StringImpl::init(const UChar* str, unsigned len)