os: ReadAt should check bounds before re-slicing destination buffer #45592
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOOS=linux
GOARCH=amd64
What did you do?
Called the
(*os.File).ReadAt
method with a 2-byte destination slice.What did you expect to see?
Data in the destination slice and no error or panic.
What did you see instead?
The panic corresponds with the source line
b = b[m:]
.Before re-slicing the destination buffer, a bounds-check is needed. Apparently, it's possible for lower layers to return more than the requested number of bytes within the initial read.
The text was updated successfully, but these errors were encountered: