aboutsummaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
authorJorropo <jorropo.pgm@gmail.com>2022-05-05 23:31:20 +0000
committerGopher Robot <gobot@golang.org>2022-05-06 14:33:48 +0000
commit119da6358bf8cc01bb8bc7556d616bd0fe723ad4 (patch)
tree332068ac47515ed9b2cffd1a7bee623f9832425f /src/debug
parentf87e28d1b9ab33491b32255f333f1f1d83eeb6fc (diff)
downloadgo-119da6358bf8cc01bb8bc7556d616bd0fe723ad4.tar.xz
debug/buildinfo: avoid nil defererence for invalid XCOFF
I've made it return 0 following what the other DataStart implementation do when they do not found the section. Fixes #52718 Change-Id: I44292fed15bb21b9aba712ad15ed74e0ce231b5a GitHub-Last-Rev: 081a35ebec9b94c0fa6a1347806d84111e58210a GitHub-Pull-Request: golang/go#52722 Reviewed-on: https://go-review.googlesource.com/c/go/+/404254 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/buildinfo/buildinfo.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/debug/buildinfo/buildinfo.go b/src/debug/buildinfo/buildinfo.go
index 8de03ff106..d1f4892751 100644
--- a/src/debug/buildinfo/buildinfo.go
+++ b/src/debug/buildinfo/buildinfo.go
@@ -393,5 +393,8 @@ func (x *xcoffExe) ReadData(addr, size uint64) ([]byte, error) {
}
func (x *xcoffExe) DataStart() uint64 {
- return x.f.SectionByType(xcoff.STYP_DATA).VirtualAddress
+ if s := x.f.SectionByType(xcoff.STYP_DATA); s != nil {
+ return s.VirtualAddress
+ }
+ return 0
}