From 081a35ebec9b94c0fa6a1347806d84111e58210a Mon Sep 17 00:00:00 2001 From: Jorropo Date: Thu, 5 May 2022 14:54:04 +0200 Subject: [PATCH] debug: fix missing C style error handling in xcoffExe.DataStart I've made it return 0 following what the other DataStart implementation do when they do not found the section. Fixes #52718 --- src/debug/buildinfo/buildinfo.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/debug/buildinfo/buildinfo.go b/src/debug/buildinfo/buildinfo.go index 8de03ff1063..d1f48927519 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 }