panic when data length is greater than memCache size
jayantxie opened this issue · 0 comments
jayantxie commented
- What version of Delve are you using (
dlv version
)?
v1.22.1 - What version of Go are you using? (
go version
)?
go1.22 - What operating system and processor architecture are you using?
linux/amd64 - What did you do?
Use*memCache.ReadMemory()
to read data with33554432
length, and then get the error:
panic: runtime error: slice bounds out of range [140022440016544:92856]
goroutine 1 [running]:
github.com/go-delve/delve/pkg/proc.(*memCache).ReadMemory(0xc00045e700, {0xc002b80000, 0x2000000, 0x2000000}, 0x7f59841ab000)
/Users/bytedance/go/pkg/mod/github.com/go-delve/delve@v1.22.2-0.20240625150328-a4196f35a95c/pkg/proc/mem.go:50 +0x395
github.com/cloudwego/goref/pkg/proc.(*memCache).ReadMemory(0xc0007064c0, {0xc0002ef188, 0x8, 0x8}, 0x7f59841ab000)
/Users/bytedance/go/src/pkg/proc/mem.go:38 +0x10e
github.com/cloudwego/goref/pkg/proc.readUintRaw({0x1860cc0, 0xc0007064c0}, 0x7f59841ab000, 0x8)
/Users/bytedance/go/src/pkg/proc/variables.go:454 +0xdd
Code line: https://github.com/go-delve/delve/blob/master/pkg/proc/mem.go#L38
It will overflow when m.cache < size.