From: Ian Lance Taylor Date: Tue, 23 Aug 2022 00:42:54 +0000 (-0700) Subject: debug/plan9obj: don't crash on EOF before symbol type X-Git-Tag: go1.20rc1~1446 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=fc0d423789e3a2e1f84801be14ac657d41c115e4;p=gostls13.git debug/plan9obj: don't crash on EOF before symbol type No debug/plan9obj test case because the problem can only happen for invalid data. Let the fuzzer find cases like this. For #47653 Fixes #54585 Change-Id: I8d3e15725b9bc09dd0e6f2750769987021f5e982 Reviewed-on: https://go-review.googlesource.com/c/go/+/425115 Auto-Submit: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Reviewed-by: David Chase Run-TryBot: Ian Lance Taylor Reviewed-by: Joseph Tsai --- diff --git a/src/debug/plan9obj/file.go b/src/debug/plan9obj/file.go index aa25809148..2b83f9bdff 100644 --- a/src/debug/plan9obj/file.go +++ b/src/debug/plan9obj/file.go @@ -212,6 +212,9 @@ func walksymtab(data []byte, ptrsz int, fn func(sym) error) error { p = p[4:] } + if len(p) < 1 { + return &formatError{len(data), "unexpected EOF", nil} + } typ := p[0] & 0x7F s.typ = typ p = p[1:]