Skip to content

Commit f9540e5

Browse files
committed
Fix #15: prevent ISO-2022-JP encoder attack
1 parent 049f926 commit f9540e5

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Overview.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<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>
99
<h1>Encoding</h1>
10-
<h2 class="no-num no-toc" id="living-standard-—-last-updated-10-february-2016">Living Standard — Last Updated 10 February 2016</h2>
10+
<h2 class="no-num no-toc" id="living-standard-—-last-updated-12-february-2016">Living Standard — Last Updated 12 February 2016</h2>
1111

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

2317+
<li>
2318+
<p>If <a href="#iso-2022-jp-encoder-state">ISO-2022-JP encoder state</a> is
2319+
<a href="#iso-2022-jp-encoder-ascii" title="iso-2022-jp encoder ASCII">ASCII</a> or
2320+
<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,
2321+
or U+001B, return <a href="#error">error</a> with U+FFFD.
2322+
2323+
<p class="note">This returns U+FFFD rather than the <var>code point</var> to prevent attacks.
2324+
<!-- https://github.com/whatwg/encoding/issues/15 -->
2325+
23172326
<li><p>If <a href="#iso-2022-jp-encoder-state">ISO-2022-JP encoder state</a> is
23182327
<a href="#iso-2022-jp-encoder-ascii" title="iso-2022-jp encoder ASCII">ASCII</a> and <var>code point</var> is an
23192328
<a href="#ascii-code-point">ASCII code point</a>, return a byte whose value is <var>code point</var>.
@@ -2904,6 +2913,7 @@ <h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
29042913
Simon Montagu,
29052914
Simon Pieters,
29062915
Simon Sapin,
2916+
寺田健 (Takeshi Terada),
29072917
Vyacheslav Matva, and
29082918
成瀬ゆい (Yui Naruse)
29092919
for being awesome.

Overview.src.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,6 +2228,15 @@ <h4><dfn>ISO-2022-JP encoder</dfn></h4>
22282228
<span>ISO-2022-JP encoder state</span> is
22292229
<span title="iso-2022-jp encoder ASCII">ASCII</span>, return <span>finished</span>.
22302230

2231+
<li>
2232+
<p>If <span>ISO-2022-JP encoder state</span> is
2233+
<span title="iso-2022-jp encoder ASCII">ASCII</span> or
2234+
<span title="iso-2022-jp encoder Roman">Roman</span>, and <var>code point</var> is U+000E, U+000F,
2235+
or U+001B, return <span>error</span> with U+FFFD.
2236+
2237+
<p class="note">This returns U+FFFD rather than the <var>code point</var> to prevent attacks.
2238+
<!-- https://github.com/whatwg/encoding/issues/15 -->
2239+
22312240
<li><p>If <span>ISO-2022-JP encoder state</span> is
22322241
<span title="iso-2022-jp encoder ASCII">ASCII</span> and <var>code point</var> is an
22332242
<span>ASCII code point</span>, return a byte whose value is <var>code point</var>.
@@ -2797,6 +2806,7 @@ <h2 class=no-num>Acknowledgments</h2>
27972806
Simon Montagu,
27982807
Simon Pieters,
27992808
Simon Sapin,
2809+
寺田健 (Takeshi Terada),
28002810
Vyacheslav Matva, and
28012811
成瀬ゆい (Yui Naruse)
28022812
for being awesome.

0 commit comments

Comments
 (0)