net/http: MaxBytesReader's Read panics when n < -1 #45101
Labels
FrozenDueToAge
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Affirmative.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Passed
n
< -1 to theMaxBytesReader
constructor.https://play.golang.org/p/aFTkl-eFmOZ
It won't compile in the playground, not sure why (
timeout running go build
).What did you expect to see?
An error; behaviour similar to how
io.LimitReader
behaves (https://play.golang.org/p/ZcUjYXNlGgR).What did you see instead?
The fix would be pretty simple, although far from an elegant one:
It was a bit unexpected for me, and if it's indeed an unexpected behaviour, I can work on this and provide some fix.
The text was updated successfully, but these errors were encountered: