]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld: avoid a segfault when dumping the symbol table
authorCarl Shapiro <cshapiro@google.com>
Mon, 28 Jan 2013 23:47:25 +0000 (15:47 -0800)
committerCarl Shapiro <cshapiro@google.com>
Mon, 28 Jan 2013 23:47:25 +0000 (15:47 -0800)
The dumping routine incorrectly assumed that all incoming
symbols would be non-nil and load through it to retrieve the
symbol name.  Instead of using the symbol to retrieve a name,
use the name provided by the caller.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7224043

src/cmd/ld/symtab.c

index 4b83e36b0152ec52442a9b4584aa0463d85c1696..87b72659b1322464e439509ce8ba3c216ee4bb81 100644 (file)
@@ -367,9 +367,9 @@ putsymb(Sym *s, char *name, int t, vlong v, vlong size, int ver, Sym *typ)
                        return;
                }
                if(ver)
-                       Bprint(&bso, "%c %.8llux %s<%d> %s\n", t, v, s->name, ver, typ ? typ->name : "");
+                       Bprint(&bso, "%c %.8llux %s<%d> %s\n", t, v, name, ver, typ ? typ->name : "");
                else
-                       Bprint(&bso, "%c %.8llux %s %s\n", t, v, s->name, typ ? typ->name : "");
+                       Bprint(&bso, "%c %.8llux %s %s\n", t, v, name, typ ? typ->name : "");
        }
 }