提交 13814543 编写于 作者: A Alessandro Arzilli 提交者: Derek Parker

proc: GetG should check that loc isn't nil before accessing its members (#1712)

Updates #1711
上级 6239f956
......@@ -478,7 +478,7 @@ func newGVariable(thread Thread, gaddr uintptr, deref bool) (*Variable, error) {
// In order to get around all this craziness, we read the address of the G structure for
// the current thread from the thread local storage area.
func GetG(thread Thread) (*G, error) {
if loc, _ := thread.Location(); loc.Fn != nil && loc.Fn.Name == "runtime.clone" {
if loc, _ := thread.Location(); loc != nil && loc.Fn != nil && loc.Fn.Name == "runtime.clone" {
// When threads are executing runtime.clone the value of TLS is unreliable.
return nil, nil
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册