]> Cypherpunks repositories - gostls13.git/commitdiff
doc/go1.17: document encoding/binary.Uvarint max read of 10 bytes
authorEmmanuel T Odeke <emmanuel@orijtech.com>
Fri, 7 May 2021 05:15:11 +0000 (22:15 -0700)
committerEmmanuel Odeke <emmanuel@orijtech.com>
Fri, 7 May 2021 18:14:25 +0000 (18:14 +0000)
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>
doc/go1.17.html

index a2e0f9454b1a2deff4687a586e485a81e2a545e5..3cd324e0ab53e023104f7a158c639057aba089b3 100644 (file)
@@ -303,7 +303,10 @@ Do not send CLs removing the interior tags from such phrases.
 <dl id="encoding/binary"><dt><a href="/pkg/encoding/binary/">encoding/binary</a></dt>
   <dd>
     <p><!-- CL 299531 -->
-      TODO: <a href="https://golang.org/cl/299531">https://golang.org/cl/299531</a>: limit bytes read by Uvarint to &lt;= 10
+      <code>binary.Uvarint</code> will stop reading after <code>10 bytes</code> to avoid
+      wasted computations. If more than <code>10 bytes</code> are needed, the byte count returned is <code>-11</code>.
+      <br />
+      Previous Go versions could return larger negative counts when reading incorrectly encoded varints.
     </p>
   </dd>
 </dl><!-- encoding/binary -->