You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When n is very large, l+n is negative and passes the cap check.
That results in an attempt to reslice with a negative capacity, panicking with runtime error: slice bounds out of range instead of the promised bytes.ErrTooLarge (https://play.golang.org/p/iwtlQtSehu).
(#19624 would report the erroneous overflow more directly.)
The text was updated successfully, but these errors were encountered:
The documentation for (*bytes.Buffer).Grow says "If the buffer can't grow it will panic with ErrTooLarge."
However, the calculation of the new size in tryGrowByReslice has an unchecked overflow:
When
n
is very large,l+n
is negative and passes thecap
check.That results in an attempt to reslice with a negative capacity, panicking with
runtime error: slice bounds out of range
instead of the promisedbytes.ErrTooLarge
(https://play.golang.org/p/iwtlQtSehu).(#19624 would report the erroneous overflow more directly.)
The text was updated successfully, but these errors were encountered: