[html5] r5942 - [giow] (0) Fix the UTF-8 decoder error handling to handle a few errors I'd misse [...]

whatwg at whatwg.org whatwg at whatwg.org
Thu Mar 3 18:56:51 PST 2011


Author: ianh
Date: 2011-03-03 18:56:49 -0800 (Thu, 03 Mar 2011)
New Revision: 5942

Modified:
   complete.html
   index
   source
Log:
[giow] (0) Fix the UTF-8 decoder error handling to handle a few errors I'd missed, including in particular surrogate halves. This may be a mistake; if I'm forgetting something please let me know so I can fix it. (e.g. did we decide not to catch surrogates or something?)
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=11298

Modified: complete.html
===================================================================
--- complete.html	2011-03-04 02:10:44 UTC (rev 5941)
+++ complete.html	2011-03-04 02:56:49 UTC (rev 5942)
@@ -3692,39 +3692,47 @@
 
   <dl class=switch><dt>One byte in the range FE to FF</dt>
 
+
    <dt><a href=#overlong-form title="overlong form">Overlong forms</a> (e.g. F0 80 80 A0)</dt>
 
-   <dt>One byte in the range C0 to C1, followed by one byte in the range 80 to BF</dt>
+   <dt>One byte in the range C0 to C1, followed by one byte in the range 80 to BF</dt> <!-- overlong ASCII (redundant with the previous line, really, but worth calling out separately as it's especially dangerous to miss this case) -->
 
+
    <dt>One byte in the range F0 to F4, followed by three bytes in the range 80 to BF that represent a code point above U+10FFFF</dt>
 
-   <dt>One byte in the range F5 to F7, followed by three bytes in the range 80 to BF</dt>
+   <dt>One byte in the range F5 to F7, followed by three bytes in the range 80 to BF</dt> <!-- above U+10FFFF -->
 
-   <dt>One byte in the range F8 to FB, followed by four bytes in the range 80 to BF</dt>
+   <dt>One byte in the range F8 to FB, followed by four bytes in the range 80 to BF</dt> <!-- above U+10FFFF -->
 
-   <dt>One byte in the range FC to FD, followed by five bytes in the range 80 to BF</dt>
+   <dt>One byte in the range FC to FD, followed by five bytes in the range 80 to BF</dt> <!-- above U+10FFFF -->
 
-   <dt>One byte in the range E0 to FD, followed by a byte in the range 80 to BF, not followed by a byte in the range 80 to BF</dt>
 
-   <dt>One byte in the range F0 to FD, followed by two bytes in the range 80 to BF, not followed by a byte in the range 80 to BF</dt>
+   <dt>One byte in the range C0 to FD that is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
 
-   <dt>One byte in the range F8 to FD, followed by three bytes in the range 80 to BF, not followed by a byte in the range 80 to BF</dt>
+   <dt>One byte in the range E0 to FD, followed by a byte in the range 80 to BF that is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
 
-   <dt>One byte in the range FC to FD, followed by four bytes in the range 80 to BF, not followed by a byte in the range 80 to BF</dt>
+   <dt>One byte in the range F0 to FD, followed by two bytes in the range 80 to BF, the last of which is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
 
+   <dt>One byte in the range F8 to FD, followed by three bytes in the range 80 to BF, the last of which is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
 
-   <dd>The whole sequence must be replaced by a single U+FFFD
+   <dt>One byte in the range FC to FD, followed by four bytes in the range 80 to BF, the last of which is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
+
+
+   <dt>Any byte sequence that represents a code point in the range U+D800 to U+DFFF</dt> <!-- surrogate halves -->
+
+
+   <dd>The whole matched sequence must be replaced by a single U+FFFD
    REPLACEMENT CHARACTER.</dd>
 
 
    <dt>One byte in the range 80 to BF not preceded by a byte in the range 80 to FD</dt>
 
-   <dt>A sequence of bytes in the range 80 to BF that does not follow a byte in the range C0 to FD</dt>
+   <dt>One byte in the range 80 to BF preceded by a byte that is part of a complete UTF-8 sequence that does not include this byte</dt>
 
-   <dt>One byte in the range C0 to FD not followed by a byte in the range 80 to BF</dt>
+   <dt>One byte in the range 80 to BF preceded by a byte that is part of a sequence that has been replaced by a U+FFFD REPLACEMENT CHARACTER, either alone or as port of a sequence</dt>
 
+   <dd>Each such byte must be replaced with a U+FFFD REPLACEMENT CHARACTER.</dd>
 
-   <dd>Each byte must be replaced with a U+FFFD REPLACEMENT CHARACTER.</dd>
 
   </dl><p>For the purposes of the above requirements, an <dfn id=overlong-form>overlong
   form</dfn> in UTF-8 is a sequence that encodes a code point using

Modified: index
===================================================================
--- index	2011-03-04 02:10:44 UTC (rev 5941)
+++ index	2011-03-04 02:56:49 UTC (rev 5942)
@@ -3672,39 +3672,47 @@
 
   <dl class=switch><dt>One byte in the range FE to FF</dt>
 
+
    <dt><a href=#overlong-form title="overlong form">Overlong forms</a> (e.g. F0 80 80 A0)</dt>
 
-   <dt>One byte in the range C0 to C1, followed by one byte in the range 80 to BF</dt>
+   <dt>One byte in the range C0 to C1, followed by one byte in the range 80 to BF</dt> <!-- overlong ASCII (redundant with the previous line, really, but worth calling out separately as it's especially dangerous to miss this case) -->
 
+
    <dt>One byte in the range F0 to F4, followed by three bytes in the range 80 to BF that represent a code point above U+10FFFF</dt>
 
-   <dt>One byte in the range F5 to F7, followed by three bytes in the range 80 to BF</dt>
+   <dt>One byte in the range F5 to F7, followed by three bytes in the range 80 to BF</dt> <!-- above U+10FFFF -->
 
-   <dt>One byte in the range F8 to FB, followed by four bytes in the range 80 to BF</dt>
+   <dt>One byte in the range F8 to FB, followed by four bytes in the range 80 to BF</dt> <!-- above U+10FFFF -->
 
-   <dt>One byte in the range FC to FD, followed by five bytes in the range 80 to BF</dt>
+   <dt>One byte in the range FC to FD, followed by five bytes in the range 80 to BF</dt> <!-- above U+10FFFF -->
 
-   <dt>One byte in the range E0 to FD, followed by a byte in the range 80 to BF, not followed by a byte in the range 80 to BF</dt>
 
-   <dt>One byte in the range F0 to FD, followed by two bytes in the range 80 to BF, not followed by a byte in the range 80 to BF</dt>
+   <dt>One byte in the range C0 to FD that is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
 
-   <dt>One byte in the range F8 to FD, followed by three bytes in the range 80 to BF, not followed by a byte in the range 80 to BF</dt>
+   <dt>One byte in the range E0 to FD, followed by a byte in the range 80 to BF that is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
 
-   <dt>One byte in the range FC to FD, followed by four bytes in the range 80 to BF, not followed by a byte in the range 80 to BF</dt>
+   <dt>One byte in the range F0 to FD, followed by two bytes in the range 80 to BF, the last of which is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
 
+   <dt>One byte in the range F8 to FD, followed by three bytes in the range 80 to BF, the last of which is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
 
-   <dd>The whole sequence must be replaced by a single U+FFFD
+   <dt>One byte in the range FC to FD, followed by four bytes in the range 80 to BF, the last of which is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
+
+
+   <dt>Any byte sequence that represents a code point in the range U+D800 to U+DFFF</dt> <!-- surrogate halves -->
+
+
+   <dd>The whole matched sequence must be replaced by a single U+FFFD
    REPLACEMENT CHARACTER.</dd>
 
 
    <dt>One byte in the range 80 to BF not preceded by a byte in the range 80 to FD</dt>
 
-   <dt>A sequence of bytes in the range 80 to BF that does not follow a byte in the range C0 to FD</dt>
+   <dt>One byte in the range 80 to BF preceded by a byte that is part of a complete UTF-8 sequence that does not include this byte</dt>
 
-   <dt>One byte in the range C0 to FD not followed by a byte in the range 80 to BF</dt>
+   <dt>One byte in the range 80 to BF preceded by a byte that is part of a sequence that has been replaced by a U+FFFD REPLACEMENT CHARACTER, either alone or as port of a sequence</dt>
 
+   <dd>Each such byte must be replaced with a U+FFFD REPLACEMENT CHARACTER.</dd>
 
-   <dd>Each byte must be replaced with a U+FFFD REPLACEMENT CHARACTER.</dd>
 
   </dl><p>For the purposes of the above requirements, an <dfn id=overlong-form>overlong
   form</dfn> in UTF-8 is a sequence that encodes a code point using

Modified: source
===================================================================
--- source	2011-03-04 02:10:44 UTC (rev 5941)
+++ source	2011-03-04 02:56:49 UTC (rev 5942)
@@ -2663,39 +2663,47 @@
 
    <dt>One byte in the range FE to FF</dt>
 
+
    <dt><span title="overlong form">Overlong forms</span> (e.g. F0 80 80 A0)</dt>
 
-   <dt>One byte in the range C0 to C1, followed by one byte in the range 80 to BF</dt>
+   <dt>One byte in the range C0 to C1, followed by one byte in the range 80 to BF</dt> <!-- overlong ASCII (redundant with the previous line, really, but worth calling out separately as it's especially dangerous to miss this case) -->
 
+
    <dt>One byte in the range F0 to F4, followed by three bytes in the range 80 to BF that represent a code point above U+10FFFF</dt>
 
-   <dt>One byte in the range F5 to F7, followed by three bytes in the range 80 to BF</dt>
+   <dt>One byte in the range F5 to F7, followed by three bytes in the range 80 to BF</dt> <!-- above U+10FFFF -->
 
-   <dt>One byte in the range F8 to FB, followed by four bytes in the range 80 to BF</dt>
+   <dt>One byte in the range F8 to FB, followed by four bytes in the range 80 to BF</dt> <!-- above U+10FFFF -->
 
-   <dt>One byte in the range FC to FD, followed by five bytes in the range 80 to BF</dt>
+   <dt>One byte in the range FC to FD, followed by five bytes in the range 80 to BF</dt> <!-- above U+10FFFF -->
 
-   <dt>One byte in the range E0 to FD, followed by a byte in the range 80 to BF, not followed by a byte in the range 80 to BF</dt>
 
-   <dt>One byte in the range F0 to FD, followed by two bytes in the range 80 to BF, not followed by a byte in the range 80 to BF</dt>
+   <dt>One byte in the range C0 to FD that is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
 
-   <dt>One byte in the range F8 to FD, followed by three bytes in the range 80 to BF, not followed by a byte in the range 80 to BF</dt>
+   <dt>One byte in the range E0 to FD, followed by a byte in the range 80 to BF that is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
 
-   <dt>One byte in the range FC to FD, followed by four bytes in the range 80 to BF, not followed by a byte in the range 80 to BF</dt>
+   <dt>One byte in the range F0 to FD, followed by two bytes in the range 80 to BF, the last of which is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
 
+   <dt>One byte in the range F8 to FD, followed by three bytes in the range 80 to BF, the last of which is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
 
-   <dd>The whole sequence must be replaced by a single U+FFFD
+   <dt>One byte in the range FC to FD, followed by four bytes in the range 80 to BF, the last of which is not followed by a byte in the range 80 to BF</dt> <!-- too short -->
+
+
+   <dt>Any byte sequence that represents a code point in the range U+D800 to U+DFFF</dt> <!-- surrogate halves -->
+
+
+   <dd>The whole matched sequence must be replaced by a single U+FFFD
    REPLACEMENT CHARACTER.</dd>
 
 
    <dt>One byte in the range 80 to BF not preceded by a byte in the range 80 to FD</dt>
 
-   <dt>A sequence of bytes in the range 80 to BF that does not follow a byte in the range C0 to FD</dt>
+   <dt>One byte in the range 80 to BF preceded by a byte that is part of a complete UTF-8 sequence that does not include this byte</dt>
 
-   <dt>One byte in the range C0 to FD not followed by a byte in the range 80 to BF</dt>
+   <dt>One byte in the range 80 to BF preceded by a byte that is part of a sequence that has been replaced by a U+FFFD REPLACEMENT CHARACTER, either alone or as port of a sequence</dt>
 
+   <dd>Each such byte must be replaced with a U+FFFD REPLACEMENT CHARACTER.</dd>
 
-   <dd>Each byte must be replaced with a U+FFFD REPLACEMENT CHARACTER.</dd>
 
   </dl>
 




More information about the Commit-Watchers mailing list