aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/objdump/testdata
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2020-03-11 13:36:42 -0400
committerDavid Chase <drchase@google.com>2020-03-12 20:40:54 +0000
commit29b36a88ab0b179c140612e7c907042b2a388587 (patch)
treef7cff4218c96143ba7f1b98c827db3f6ac321117 /src/cmd/objdump/testdata
parente221a75deab7843d5414154000f5bea7abcb60c3 (diff)
downloadgo-29b36a88ab0b179c140612e7c907042b2a388587.tar.xz
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 <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/objdump/testdata')
-rw-r--r--src/cmd/objdump/testdata/fmthello.go2
1 files changed, 2 insertions, 0 deletions
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 {
}
}