From 29b36a88ab0b179c140612e7c907042b2a388587 Mon Sep 17 00:00:00 2001 From: David Chase Date: Wed, 11 Mar 2020 13:36:42 -0400 Subject: cmd/objdump: guard against out-of-range lines from directives. //line bogo.go:9999999 will cause 'go tool objdump' to crash unless bogo.go has that many lines. Guard the array index and return innocuous values (nil, nil) from the file cache. Fixes #36683 Change-Id: I4a9f8444dc611654d270cc876e8848dfd2f84770 Reviewed-on: https://go-review.googlesource.com/c/go/+/223081 Run-TryBot: David Chase TryBot-Result: Gobot Gobot Reviewed-by: Cherry Zhang --- src/cmd/objdump/testdata/fmthello.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/cmd/objdump/testdata') diff --git a/src/cmd/objdump/testdata/fmthello.go b/src/cmd/objdump/testdata/fmthello.go index fd16ebee1b..c8d82466dc 100644 --- a/src/cmd/objdump/testdata/fmthello.go +++ b/src/cmd/objdump/testdata/fmthello.go @@ -5,6 +5,8 @@ import "fmt" func main() { Println("hello, world") if flag { +//line fmthello.go:999999 + Println("bad line") for { } } -- cgit v1.3-5-g9baa