Skip to content

Commit

Permalink
Fix #15: prevent ISO-2022-JP encoder attack
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Feb 12, 2016
1 parent 049f926 commit f9540e5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<p><a class="logo" href="https://whatwg.org/"><img alt="WHATWG" height="100" src="https://resources.whatwg.org/logo-encoding.svg" width="100"></a></p>
<h1>Encoding</h1>
<h2 class="no-num no-toc" id="living-standard-—-last-updated-10-february-2016">Living Standard — Last Updated 10 February 2016</h2>
<h2 class="no-num no-toc" id="living-standard-—-last-updated-12-february-2016">Living Standard — Last Updated 12 February 2016</h2>

<dl>
<dt>Participate:
Expand Down Expand Up @@ -2314,6 +2314,15 @@ <h4 id="iso-2022-jp-encoder"><span class="secno">13.2.2 </span><dfn>ISO-2022-JP
<a href="#iso-2022-jp-encoder-state">ISO-2022-JP encoder state</a> is
<a href="#iso-2022-jp-encoder-ascii" title="iso-2022-jp encoder ASCII">ASCII</a>, return <a href="#finished">finished</a>.

<li>
<p>If <a href="#iso-2022-jp-encoder-state">ISO-2022-JP encoder state</a> is
<a href="#iso-2022-jp-encoder-ascii" title="iso-2022-jp encoder ASCII">ASCII</a> or
<a href="#iso-2022-jp-encoder-roman" title="iso-2022-jp encoder Roman">Roman</a>, and <var>code point</var> is U+000E, U+000F,
or U+001B, return <a href="#error">error</a> with U+FFFD.

<p class="note">This returns U+FFFD rather than the <var>code point</var> to prevent attacks.
<!-- https://github.com/whatwg/encoding/issues/15 -->

<li><p>If <a href="#iso-2022-jp-encoder-state">ISO-2022-JP encoder state</a> is
<a href="#iso-2022-jp-encoder-ascii" title="iso-2022-jp encoder ASCII">ASCII</a> and <var>code point</var> is an
<a href="#ascii-code-point">ASCII code point</a>, return a byte whose value is <var>code point</var>.
Expand Down Expand Up @@ -2904,6 +2913,7 @@ <h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
Simon Montagu,
Simon Pieters,
Simon Sapin,
寺田健 (Takeshi Terada),
Vyacheslav Matva, and
成瀬ゆい (Yui Naruse)
for being awesome.
Expand Down
10 changes: 10 additions & 0 deletions Overview.src.html
Original file line number Diff line number Diff line change
Expand Up @@ -2228,6 +2228,15 @@ <h4><dfn>ISO-2022-JP encoder</dfn></h4>
<span>ISO-2022-JP encoder state</span> is
<span title="iso-2022-jp encoder ASCII">ASCII</span>, return <span>finished</span>.

<li>
<p>If <span>ISO-2022-JP encoder state</span> is
<span title="iso-2022-jp encoder ASCII">ASCII</span> or
<span title="iso-2022-jp encoder Roman">Roman</span>, and <var>code point</var> is U+000E, U+000F,
or U+001B, return <span>error</span> with U+FFFD.

<p class="note">This returns U+FFFD rather than the <var>code point</var> to prevent attacks.
<!-- https://github.com/whatwg/encoding/issues/15 -->

<li><p>If <span>ISO-2022-JP encoder state</span> is
<span title="iso-2022-jp encoder ASCII">ASCII</span> and <var>code point</var> is an
<span>ASCII code point</span>, return a byte whose value is <var>code point</var>.
Expand Down Expand Up @@ -2797,6 +2806,7 @@ <h2 class=no-num>Acknowledgments</h2>
Simon Montagu,
Simon Pieters,
Simon Sapin,
寺田健 (Takeshi Terada),
Vyacheslav Matva, and
成瀬ゆい (Yui Naruse)
for being awesome.
Expand Down

0 comments on commit f9540e5

Please sign in to comment.