Skip to content

Commit af6123a

Browse files
committed
doc/go1.17: document encoding/binary.Uvarint max read of 10 bytes
Updates #41185 For #44513. Fixes #46009 Change-Id: I60f4d891b897809765acc0aace037c78e95bb4f7 Reviewed-on: https://go-review.googlesource.com/c/go/+/317929 Trust: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Keith Randall <khr@golang.org>
1 parent b44c78b commit af6123a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

doc/go1.17.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,10 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
303303
<dl id="encoding/binary"><dt><a href="/pkg/encoding/binary/">encoding/binary</a></dt>
304304
<dd>
305305
<p><!-- CL 299531 -->
306-
TODO: <a href="https://golang.org/cl/299531">https://golang.org/cl/299531</a>: limit bytes read by Uvarint to &lt;= 10
306+
<code>binary.Uvarint</code> will stop reading after <code>10 bytes</code> to avoid
307+
wasted computations. If more than <code>10 bytes</code> are needed, the byte count returned is <code>-11</code>.
308+
<br />
309+
Previous Go versions could return larger negative counts when reading incorrectly encoded varints.
307310
</p>
308311
</dd>
309312
</dl><!-- encoding/binary -->

0 commit comments

Comments
 (0)