aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/debug/macho/file.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/debug/macho/file.go b/src/debug/macho/file.go
index 9806c270bf..3e339c32c6 100644
--- a/src/debug/macho/file.go
+++ b/src/debug/macho/file.go
@@ -350,7 +350,9 @@ func NewFile(r io.ReaderAt) (*File, error) {
if err := binary.Read(b, bo, &hdr); err != nil {
return nil, err
}
- if hdr.Iundefsym > uint32(len(f.Symtab.Syms)) {
+ if f.Symtab == nil {
+ return nil, &FormatError{offset, "dynamic symbol table seen before any ordinary symbol table", nil}
+ } else if hdr.Iundefsym > uint32(len(f.Symtab.Syms)) {
return nil, &FormatError{offset, fmt.Sprintf(
"undefined symbols index in dynamic symbol table command is greater than symbol table length (%d > %d)",
hdr.Iundefsym, len(f.Symtab.Syms)), nil}