Skip to content

Commit e8fbad5

Browse files
ianlancetaylorgopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]>
1 parent 41e8679 commit e8fbad5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/debug/macho/file.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@ func NewFile(r io.ReaderAt) (*File, error) {
361361
"number of undefined symbols after index in dynamic symbol table command is greater than symbol table length (%d > %d)",
362362
hdr.Iundefsym+hdr.Nundefsym, len(f.Symtab.Syms)), nil}
363363
}
364-
dat := make([]byte, hdr.Nindirectsyms*4)
365-
if _, err := r.ReadAt(dat, int64(hdr.Indirectsymoff)); err != nil {
364+
dat, err := saferio.ReadDataAt(r, uint64(hdr.Nindirectsyms)*4, int64(hdr.Indirectsymoff))
365+
if err != nil {
366366
return nil, err
367367
}
368368
x := make([]uint32, hdr.Nindirectsyms)

0 commit comments

Comments
 (0)