Commit 448f84a4 authored by Rob Pike's avatar Rob Pike

internal/obj: protect against nil addr.Sym

This has been the root cause of a number of crashes caused by
fuzz throwing modem noise at the assembler, which in turn attempts
to print diagnostics but instead just gets crashes.

Fixes #12627.

Change-Id: I72c2da79d8eb240e1a37aa6140454c552b05e0f1
Reviewed-on: https://go-review.googlesource.com/14595Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent dace9397
......@@ -457,13 +457,25 @@ func Mconv(a *Addr) string {
}
case NAME_EXTERN:
if a.Sym != nil {
str = fmt.Sprintf("%s%s(SB)", a.Sym.Name, offConv(a.Offset))
} else {
str = fmt.Sprintf("%s(SB)", offConv(a.Offset))
}
case NAME_GOTREF:
if a.Sym != nil {
str = fmt.Sprintf("%s%s@GOT(SB)", a.Sym.Name, offConv(a.Offset))
} else {
str = fmt.Sprintf("%s@GOT(SB)", offConv(a.Offset))
}
case NAME_STATIC:
if a.Sym != nil {
str = fmt.Sprintf("%s<>%s(SB)", a.Sym.Name, offConv(a.Offset))
} else {
str = fmt.Sprintf("<>%s(SB)", offConv(a.Offset))
}
case NAME_AUTO:
if a.Sym != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment