]> Cypherpunks.ru repositories - gostls13.git/commit
mime/multipart: fix Reader.ReadForm(math.MaxInt64) overflow
authorhopehook <hopehook@qq.com>
Sun, 12 Feb 2023 14:27:35 +0000 (22:27 +0800)
committerGopher Robot <gobot@golang.org>
Tue, 28 Feb 2023 17:49:22 +0000 (17:49 +0000)
commitd61ae9ded4ebc142fb0edccfee893fa10c233357
tree7fc0ee4609eda24e21022016973dff3a1e0c8f0f
parenteee2697c38b73b731604d5584abd97bf674857ed
mime/multipart: fix Reader.ReadForm(math.MaxInt64) overflow

Because "CopyN" will read one more byte, which will cause us
to overflow when calling "Reader.ReadForm(math.MaxInt64)".

So we should check if the parameter exceeds "math.MaxInt64"
to avoid returning no data.

Fixes #58384.

Change-Id: I30088ce6468176b21e4a9a0b8b6080f2986dda23
Reviewed-on: https://go-review.googlesource.com/c/go/+/467557
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Run-TryBot: hopehook <hopehook@golangcn.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/mime/multipart/formdata.go
src/mime/multipart/formdata_test.go