parseHTMLInteger shouldn't upconvert 8-bit string
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Jul 2013 15:32:07 +0000 (15:32 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Jul 2013 15:32:07 +0000 (15:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=118629

Reviewed by Sam Weinig.

Merge https://chromium.googlesource.com/chromium/blink/+/e0ebab23e0c16b49dc90c9c39b8bbbf4f243a01e.

* html/parser/HTMLParserIdioms.cpp:
(WebCore::parseHTMLInteger):

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

Source/WebCore/ChangeLog
Source/WebCore/html/parser/HTMLParserIdioms.cpp

index 4894253de7192dbd8d0109a8f135fec5a73d6500..ee5e109d777725c12e09d0e681382f2eb48d8339 100644 (file)
@@ -1,3 +1,15 @@
+2013-07-13  Ryosuke Niwa  <rniwa@webkit.org>
+
+        parseHTMLInteger shouldn't upconvert 8-bit string
+        https://bugs.webkit.org/show_bug.cgi?id=118629
+
+        Reviewed by Sam Weinig.
+
+        Merge https://chromium.googlesource.com/chromium/blink/+/e0ebab23e0c16b49dc90c9c39b8bbbf4f243a01e.
+
+        * html/parser/HTMLParserIdioms.cpp:
+        (WebCore::parseHTMLInteger):
+
 2013-07-12  Eric Carlson  <eric.carlson@apple.com>
 
         [iOS] TextTrackRepresentation not cleared when captions are disabled
index 09ec68bddfd86e1a56c07c7939b27d32c28a1c0f..e10a5cdecf878204e4429775c6700d242aec49ba 100644 (file)
@@ -207,12 +207,12 @@ bool parseHTMLInteger(const String& input, int& value)
     // Step 1
     // Step 2
     unsigned length = input.length();
-    if (length && input.is8Bit()) {
+    if (!length || input.is8Bit()) {
         const LChar* start = input.characters8();
         return parseHTMLIntegerInternal(start, start + length, value);
     }
 
-    const UChar* start = input.characters();
+    const UChar* start = input.characters16();
     return parseHTMLIntegerInternal(start, start + length, value);
 }