[html5] r5046 - [t] (0) Rework the server algorithm to have bail-out points in more appropriate [...]

whatwg at whatwg.org whatwg at whatwg.org
Wed Apr 14 14:59:56 PDT 2010


Author: ianh
Date: 2010-04-14 14:59:55 -0700 (Wed, 14 Apr 2010)
New Revision: 5046

Modified:
   complete.html
   source
Log:
[t] (0) Rework the server algorithm to have bail-out points in more appropriate spots.

Modified: complete.html
===================================================================
--- complete.html	2010-04-14 09:13:47 UTC (rev 5045)
+++ complete.html	2010-04-14 21:59:55 UTC (rev 5046)
@@ -71069,15 +71069,17 @@
   <ol><li id=ws-sd-frame><p><i title="">Frame</i>: Read a byte from the
    client. Let <var title="">type</var> be that byte.</li>
 
-   <li><p>If <var title="">type</var> is not a 0x00 byte, then the
-   server may disconnect from the client.</p>
-
    <li>
 
     <p>If the most significant bit of <var title="">type</var> is not
     set, then run the following steps:</p>
 
-    <ol><li><p>Let <var title="">raw data</var> be an empty byte
+    <ol><li><p>If <var title="">type</var> is not a 0x00 byte, then the
+     server may abort these steps and either immediately disconnect
+     from the client or set the <var title="">client terminated</var>
+     flag.</li>
+
+     <li><p>Let <var title="">raw data</var> be an empty byte
      array.</li>
 
      <li id=ws-sd-data><p><i>Data</i>: Read a byte, let <var title="">b</var> be that byte.</li>
@@ -71085,49 +71087,63 @@
      <li><p>If <var title="">b</var> is not 0xFF, then append <var title="">b</var> to <var title="">raw data</var> and return to
      the previous step (labeled <a href=#ws-sd-data><i>data</i></a>).</li>
 
-     <li><p>Interpret <var title="">raw data</var> as a UTF-8 string,
-     and apply whatever server-specific processing is to occur for the
-     resulting string (the message from the client).</p>
+     <li><p>If <var title="">type</var> was 0x00, interpret <var title="">raw data</var> as a UTF-8 string, and apply whatever
+     server-specific processing is to occur for the resulting string
+     (the message from the client).</p>
 
     </ol><p>Otherwise, the most significant bit of <var title="">type</var>
-    is set. Run the following steps. This can never happen if <var title="">type</var> is 0x00, and therefore these steps are not
-    necessary if the server aborts when <var title="">type</var> is
-    not 0x00, as allowed above.</p>
+    is set. Run the following steps.</p>
 
-    <ol><li><p>Let <var title="">length</var> be zero.</li>
+    <ol><li><p>If <var title="">type</var> is not a 0xFF byte, then the
+     server may abort these steps and either immediately disconnect
+     from the client or set the <var title="">client terminated</var>
+     flag.</li>
 
+     <li><p>Let <var title="">length</var> be zero.</li>
+
      <li id=ws-sd-length><p><i>Length</i>: Read a byte, let <var title="">b</var> be that byte.</li>
 
-     <li><p>Let <var title="">b<sub title="">v</sub></var> be an
-     integer corresponding to the low 7 bits of <var title="">b</var>
-     (the value you would get by <i>and</i>ing <var title="">b</var>
-     with 0x7F).</li>
+     <li>
 
-     <li><p>Multiply <var title="">length</var> by 128, add <var title="">b<sub title="">v</sub></var> to that result, and store
-     the final result in <var title="">length</var>.</li>
+      <p>If <var title="">b</var> is not a 0x00 byte, then run these
+      substeps:</p>
 
-     <li><p>If the high-order bit of <var title="">b</var> is set
-     (i.e. if <var title="">b</var> <i title="">and</i>ed with 0x80
-     returns 0x80), then return to the step above labeled <a href=#ws-sd-length><i>length</i></a>.</li>
+      <ol><li><p>The server may abort these steps and either immediately
+       disconnect from the client or set the <var title="">client
+       terminated</var> flag.</li>
 
-     <li>
+       <li><p>Let <var title="">b<sub title="">v</sub></var> be an
+       integer corresponding to the low 7 bits of <var title="">b</var>
+       (the value you would get by <i>and</i>ing <var title="">b</var>
+       with 0x7F).</li>
 
-      <p>Read <var title="">length</var> bytes.</p>
+       <li><p>Multiply <var title="">length</var> by 128, add <var title="">b<sub title="">v</sub></var> to that result, and store
+       the final result in <var title="">length</var>.</li>
 
-      <p class=warning>It is possible for a malicious client to send
-      frames with lengths greater than 2<sup>31</sup> or
-      2<sup>32</sup> bytes, overflowing a signed or unsigned 32bit
-      integer. Servers may therefore impose implementation-specific
-      limits on the lengths of invalid frames that they will skip, if
-      they support skipping such frames at all. If a server cannot
-      correctly skip past a long frame, then the server must abort
-      these steps (discarding all future data), and should either
-      immediately disconnect from the client or set the <var title="">client terminated</var> flag.</p>
+       <li><p>If the high-order bit of <var title="">b</var> is set
+       (i.e. if <var title="">b</var> <i title="">and</i>ed with 0x80
+       returns 0x80), then return to the step above labeled <a href=#ws-sd-length><i>length</i></a>.</li>
 
-     </li>
+       <li>
 
-     <li><p>Discard the read bytes.</li>
+        <p>Read <var title="">length</var> bytes.</p>
 
+        <p class=warning>It is possible for a malicious client to send
+        frames with lengths greater than 2<sup>31</sup> or
+        2<sup>32</sup> bytes, overflowing a signed or unsigned 32bit
+        integer. Servers may therefore impose implementation-specific
+        limits on the lengths of invalid frames that they will skip, if
+        they support skipping such frames at all. If a server cannot
+        correctly skip past a long frame, then the server must abort
+        these steps (discarding all future data), and should either
+        immediately disconnect from the client or set the <var title="">client terminated</var> flag.</p>
+
+       </li>
+
+       <li><p>Discard the read bytes.</li>
+
+      </ol></li>
+
      <li><p>If <var title="">type</var> is 0xFF and <var title="">length</var> is 0, then set the <var title="">client
      terminated</var> flag and abort these steps. All further data
      sent by the client should be discarded.</li>

Modified: source
===================================================================
--- source	2010-04-14 09:13:47 UTC (rev 5045)
+++ source	2010-04-14 21:59:55 UTC (rev 5046)
@@ -79755,9 +79755,6 @@
    <li id="ws-sd-frame"><p><i title="">Frame</i>: Read a byte from the
    client. Let <var title="">type</var> be that byte.</p></li>
 
-   <li><p>If <var title="">type</var> is not a 0x00 byte, then the
-   server may disconnect from the client.</p>
-
    <li>
 
     <p>If the most significant bit of <var title="">type</var> is not
@@ -79765,6 +79762,11 @@
 
     <ol>
 
+     <li><p>If <var title="">type</var> is not a 0x00 byte, then the
+     server may abort these steps and either immediately disconnect
+     from the client or set the <var title="">client terminated</var>
+     flag.</p></li>
+
      <li><p>Let <var title="">raw data</var> be an empty byte
      array.</p></li>
 
@@ -79776,58 +79778,76 @@
      the previous step (labeled <a
      href="#ws-sd-data"><i>data</i></a>).</p></li>
 
-     <li><p>Interpret <var title="">raw data</var> as a UTF-8 string,
-     and apply whatever server-specific processing is to occur for the
-     resulting string (the message from the client).</p>
+     <li><p>If <var title="">type</var> was 0x00, interpret <var
+     title="">raw data</var> as a UTF-8 string, and apply whatever
+     server-specific processing is to occur for the resulting string
+     (the message from the client).</p>
 
     </ol>
 
     <p>Otherwise, the most significant bit of <var title="">type</var>
-    is set. Run the following steps. This can never happen if <var
-    title="">type</var> is 0x00, and therefore these steps are not
-    necessary if the server aborts when <var title="">type</var> is
-    not 0x00, as allowed above.</p>
+    is set. Run the following steps.</p>
 
     <ol>
 
+     <li><p>If <var title="">type</var> is not a 0xFF byte, then the
+     server may abort these steps and either immediately disconnect
+     from the client or set the <var title="">client terminated</var>
+     flag.</p></li>
+
      <li><p>Let <var title="">length</var> be zero.</p></li>
 
      <li id="ws-sd-length"><p><i>Length</i>: Read a byte, let <var
      title="">b</var> be that byte.</p></li>
 
-     <li><p>Let <var title="">b<sub title="">v</sub></var> be an
-     integer corresponding to the low 7 bits of <var title="">b</var>
-     (the value you would get by <i>and</i>ing <var title="">b</var>
-     with 0x7F).</p></li>
+     <li>
 
-     <li><p>Multiply <var title="">length</var> by 128, add <var
-     title="">b<sub title="">v</sub></var> to that result, and store
-     the final result in <var title="">length</var>.</p></li>
+      <p>If <var title="">b</var> is not a 0x00 byte, then run these
+      substeps:</p>
 
-     <li><p>If the high-order bit of <var title="">b</var> is set
-     (i.e. if <var title="">b</var> <i title="">and</i>ed with 0x80
-     returns 0x80), then return to the step above labeled <a
-     href="#ws-sd-length"><i>length</i></a>.</p></li>
+      <ol>
 
-     <li>
+       <li><p>The server may abort these steps and either immediately
+       disconnect from the client or set the <var title="">client
+       terminated</var> flag.</p></li>
 
-      <p>Read <var title="">length</var> bytes.</p>
+       <li><p>Let <var title="">b<sub title="">v</sub></var> be an
+       integer corresponding to the low 7 bits of <var title="">b</var>
+       (the value you would get by <i>and</i>ing <var title="">b</var>
+       with 0x7F).</p></li>
 
-      <p class="warning">It is possible for a malicious client to send
-      frames with lengths greater than 2<sup>31</sup> or
-      2<sup>32</sup> bytes, overflowing a signed or unsigned 32bit
-      integer. Servers may therefore impose implementation-specific
-      limits on the lengths of invalid frames that they will skip, if
-      they support skipping such frames at all. If a server cannot
-      correctly skip past a long frame, then the server must abort
-      these steps (discarding all future data), and should either
-      immediately disconnect from the client or set the <var
-      title="">client terminated</var> flag.</p>
+       <li><p>Multiply <var title="">length</var> by 128, add <var
+       title="">b<sub title="">v</sub></var> to that result, and store
+       the final result in <var title="">length</var>.</p></li>
 
+       <li><p>If the high-order bit of <var title="">b</var> is set
+       (i.e. if <var title="">b</var> <i title="">and</i>ed with 0x80
+       returns 0x80), then return to the step above labeled <a
+       href="#ws-sd-length"><i>length</i></a>.</p></li>
+
+       <li>
+
+        <p>Read <var title="">length</var> bytes.</p>
+
+        <p class="warning">It is possible for a malicious client to send
+        frames with lengths greater than 2<sup>31</sup> or
+        2<sup>32</sup> bytes, overflowing a signed or unsigned 32bit
+        integer. Servers may therefore impose implementation-specific
+        limits on the lengths of invalid frames that they will skip, if
+        they support skipping such frames at all. If a server cannot
+        correctly skip past a long frame, then the server must abort
+        these steps (discarding all future data), and should either
+        immediately disconnect from the client or set the <var
+        title="">client terminated</var> flag.</p>
+
+       </li>
+
+       <li><p>Discard the read bytes.</p></li>
+
+      </ol>
+
      </li>
 
-     <li><p>Discard the read bytes.</p></li>
-
      <li><p>If <var title="">type</var> is 0xFF and <var
      title="">length</var> is 0, then set the <var title="">client
      terminated</var> flag and abort these steps. All further data




More information about the Commit-Watchers mailing list