aboutsummaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2023-02-21 10:14:20 -0800
committerGopher Robot <gobot@golang.org>2023-02-21 23:27:49 +0000
commited33ae10a011c85f51be2c970f52d769722b0ec7 (patch)
tree8ae59617f785a63c85dff5d99a0f69929d5b2805 /src/debug
parentdd87e33d88eadaf5302895fb91b0a0e2e16b136e (diff)
downloadgo-ed33ae10a011c85f51be2c970f52d769722b0ec7.tar.gz
debug/macho: use saferio to read symbol table strings
No test case because the problem can only happen for invalid data. Let the fuzzer find cases like this. For #47653 Fixes #58603 Change-Id: I67fc45365c1a5b0b4b381f541bf2fee8ce8ddc3a Reviewed-on: https://go-review.googlesource.com/c/go/+/469895 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/macho/file.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/debug/macho/file.go b/src/debug/macho/file.go
index ecde25ab89..9806c270bf 100644
--- a/src/debug/macho/file.go
+++ b/src/debug/macho/file.go
@@ -323,8 +323,8 @@ func NewFile(r io.ReaderAt) (*File, error) {
if err := binary.Read(b, bo, &hdr); err != nil {
return nil, err
}
- strtab := make([]byte, hdr.Strsize)
- if _, err := r.ReadAt(strtab, int64(hdr.Stroff)); err != nil {
+ strtab, err := saferio.ReadDataAt(r, uint64(hdr.Strsize), int64(hdr.Stroff))
+ if err != nil {
return nil, err
}
var symsz int