Commit 82f5efcb authored by kbr@google.com's avatar kbr@google.com
Browse files

2010-07-09 Kenneth Russell <kbr@google.com>

        Reviewed by Dimitri Glazkov.

        Assertion failure in String::utf8() for certain invalid UTF16 inputs
        https://bugs.webkit.org/show_bug.cgi?id=41983

        * wtf/text/WTFString.cpp:
        (WebCore::String::utf8):
         - Fixed assertion when sourceExhausted is returned from convertUTF16ToUTF8.
2010-07-09  Kenneth Russell  <kbr@google.com>

        Reviewed by Dimitri Glazkov.

        Assertion failure in String::utf8() for certain invalid UTF16 inputs
        https://bugs.webkit.org/show_bug.cgi?id=41983

        * fast/canvas/webgl/invalid-UTF-16-expected.txt: Added.
        * fast/canvas/webgl/invalid-UTF-16.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1081015b
2010-07-09 Kenneth Russell <kbr@google.com>
Reviewed by Dimitri Glazkov.
Assertion failure in String::utf8() for certain invalid UTF16 inputs
https://bugs.webkit.org/show_bug.cgi?id=41983
* wtf/text/WTFString.cpp:
(WebCore::String::utf8):
- Fixed assertion when sourceExhausted is returned from convertUTF16ToUTF8.
2010-07-09 Oliver Hunt <oliver@apple.com>
Reviewed by Geoffrey Garen.
......
......@@ -663,7 +663,7 @@ CString String::utf8() const
// simply encode it to UTF-8.
if (result == sourceExhausted) {
// This should be one unpaired high surrogate.
ASSERT((characters + 1) == (characters + length));
ASSERT((characters + 1) == (this->characters() + length));
ASSERT((*characters >= 0xD800) && (*characters <= 0xDBFF));
// There should be room left, since one UChar hasn't been converted.
ASSERT((buffer + 3) <= (buffer + bufferVector.size()));
......
2010-07-09 Kenneth Russell <kbr@google.com>
Reviewed by Dimitri Glazkov.
Assertion failure in String::utf8() for certain invalid UTF16 inputs
https://bugs.webkit.org/show_bug.cgi?id=41983
* fast/canvas/webgl/invalid-UTF-16-expected.txt: Added.
* fast/canvas/webgl/invalid-UTF-16.html: Added.
2010-07-09 Tony Gentilcore <tonyg@chromium.org>
 
Reviewed by Dimitri Glazkov.
This test verifies that the internal conversion from UTF16 to UTF8 is robust to invalid inputs. Any DOM entry point which converts an incoming string to UTF8 could be used for this test.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS bindAttribLocation with invalid UTF-16 did not crash
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<link rel="stylesheet" href="../../js/resources/js-test-style.css">
<script src="../../js/resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
</script>
<script>
description('This test verifies that the internal conversion from UTF16 to UTF8 is robust to invalid inputs. Any DOM entry point which converts an incoming string to UTF8 could be used for this test.');
var array = [];
array.push(String.fromCharCode(0x48)); // H
array.push(String.fromCharCode(0x69)); // i
array.push(String.fromCharCode(0xd87e)); // Bogus
var string = array.join('');
// In order to make this test not depend on WebGL, the following were
// attempted:
// - Send a string to console.log
// - Submit a mailto: form containing a text input with the bogus
// string
// The first code path does not perform a utf8 conversion of the
// incoming string unless Console::shouldPrintExceptions() returns
// true. The second seems to sanitize the form's input before
// converting it to a UTF8 string.
var gl = create3DContext(null);
var program = gl.createProgram();
gl.bindAttribLocation(program, 0, string);
testPassed("bindAttribLocation with invalid UTF-16 did not crash");
successfullyParsed = true;
</script>
<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment