aboutsummaryrefslogtreecommitdiff
path: root/src/debug/macho/file.go
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2021-11-04 14:11:57 -0400
committerThan McIntosh <thanm@google.com>2021-11-04 14:11:57 -0400
commit06a4b2790c5bb6530e0c4f05277b19c187134f49 (patch)
tree09017cea1bfb6b6ba6eb191438232c064d55153d /src/debug/macho/file.go
parent35d5cd0dcfb9d06064ec37da1621d24676454058 (diff)
parent23991f50b34f8707bcfc7761321bb3b0e9dba10e (diff)
downloadgo-06a4b2790c5bb6530e0c4f05277b19c187134f49.tar.gz
go-06a4b2790c5bb6530e0c4f05277b19c187134f49.zip
[dev.boringcrypto.go1.16] all: merge go1.16.10 into dev.boringcrypto.go1.16
Change-Id: I164105d3036f0729da3f0b1dfa034f1d1d6a3a27
Diffstat (limited to 'src/debug/macho/file.go')
-rw-r--r--src/debug/macho/file.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/debug/macho/file.go b/src/debug/macho/file.go
index 085b0c8219..73cfce3c76 100644
--- a/src/debug/macho/file.go
+++ b/src/debug/macho/file.go
@@ -345,6 +345,15 @@ 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)) {
+ 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}
+ } else if hdr.Iundefsym+hdr.Nundefsym > uint32(len(f.Symtab.Syms)) {
+ return nil, &FormatError{offset, fmt.Sprintf(
+ "number of undefined symbols after index in dynamic symbol table command is greater than symbol table length (%d > %d)",
+ hdr.Iundefsym+hdr.Nundefsym, len(f.Symtab.Syms)), nil}
+ }
dat := make([]byte, hdr.Nindirectsyms*4)
if _, err := r.ReadAt(dat, int64(hdr.Indirectsymoff)); err != nil {
return nil, err