-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
What version of Go are you using (go version)?
$ go version go version go1.15.5 linux/amd64
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?
panic: runtime error: slice bounds out of range [4:2]
goroutine 63 [running]:
os.(*File).ReadAt(...)
/usr/local/go/src/os/file.go:140 +0x3e5
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.
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.