From 3de29a88f82168734c46f3386a1ced1fcb717871 Mon Sep 17 00:00:00 2001 From: Alessandro Arzilli Date: Tue, 9 Aug 2022 19:02:55 +0200 Subject: [PATCH] proc: do not panic reading bad G struct (#3098) Fixes #3095 --- pkg/proc/variables.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/proc/variables.go b/pkg/proc/variables.go index d72c5e03..37d0213e 100644 --- a/pkg/proc/variables.go +++ b/pkg/proc/variables.go @@ -896,11 +896,15 @@ func (v *Variable) parseG() (*G, error) { } var stackhi, stacklo uint64 if stackVar := v.loadFieldNamed("stack"); /* +rtype stack */ stackVar != nil { - if stackhiVar := stackVar.fieldVariable("hi"); /* +rtype uintptr */ stackhiVar != nil { + if stackhiVar := stackVar.fieldVariable("hi"); /* +rtype uintptr */ stackhiVar != nil && stackhiVar.Value != nil { stackhi, _ = constant.Uint64Val(stackhiVar.Value) + } else { + unreadable = true } - if stackloVar := stackVar.fieldVariable("lo"); /* +rtype uintptr */ stackloVar != nil { + if stackloVar := stackVar.fieldVariable("lo"); /* +rtype uintptr */ stackloVar != nil && stackloVar.Value != nil { stacklo, _ = constant.Uint64Val(stackloVar.Value) + } else { + unreadable = true } }