diff options
author | Ian Lance Taylor <iant@golang.org> | 2023-02-27 15:52:52 -0800 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2023-02-28 06:02:49 +0000 |
commit | e8fbad5de87f34d2e7632f94cac418c7436174ce (patch) | |
tree | 9aabf571bea922e20da14e200ecd5dccf957915b /src/debug | |
parent | 41e8679611fdee738065b91588b7016880ffde61 (diff) | |
download | go-e8fbad5de87f34d2e7632f94cac418c7436174ce.tar.gz |
debug/macho: use saferio to read dynamic indirect symbols
No test case because the problem can only happen for invalid data. Let
the fuzzer find cases like this.
For #47653
Fixes #58755
Change-Id: I5b95a21f47ec306ad90cd6221f0566c6f8b6c3ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/471835
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/debug')
-rw-r--r-- | src/debug/macho/file.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/debug/macho/file.go b/src/debug/macho/file.go index 3e339c32c6..7cba3398fb 100644 --- a/src/debug/macho/file.go +++ b/src/debug/macho/file.go @@ -361,8 +361,8 @@ func NewFile(r io.ReaderAt) (*File, error) { "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 { + dat, err := saferio.ReadDataAt(r, uint64(hdr.Nindirectsyms)*4, int64(hdr.Indirectsymoff)) + if err != nil { return nil, err } x := make([]uint32, hdr.Nindirectsyms) |