Skip to content

Commit 38f0a82

Browse files
prattmicgopherbot
authored andcommitted
debug/buildid: treat too large string as "not a Go executable"
If the length does not fit in int, saferio.ReadDataAt returns io.ErrUnexpectedEOF. Treat is as an invalid format. Fixes #68692. For #68592. Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest Change-Id: Ie856f29c907fd10e6d9b7dfbb6f0d8008a75a1c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/602435 Auto-Submit: Michael Pratt <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent b26134b commit 38f0a82

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/debug/buildinfo/buildinfo.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@ func decodeString(x exe, addr uint64) (string, uint64, error) {
295295

296296
b, err = readData(x, addr, length)
297297
if err != nil {
298+
if err == io.ErrUnexpectedEOF {
299+
// Length too large to allocate. Clearly bogus value.
300+
return "", 0, errNotGoExe
301+
}
298302
return "", 0, err
299303
}
300304
if uint64(len(b)) < length {

0 commit comments

Comments
 (0)