mirror of
https://github.com/golang/go
synced 2024-09-29 13:14:28 -06:00
internal/xcoff: better handling of malformed symbol tables
Check for malformed data when reading the number of aux symbols associated with a symbol table entry. Fixes #54584. Change-Id: Ic2a8d4d6a1d481d585a065b8182de86294c3d3d1 Reviewed-on: https://go-review.googlesource.com/c/go/+/425049 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
bdecfcb5fc
commit
db3e915af2
@ -283,6 +283,9 @@ func NewFile(r io.ReaderAt) (*File, error) {
|
||||
return nil, err
|
||||
}
|
||||
numaux = int(se.Nnumaux)
|
||||
if numaux < 0 {
|
||||
return nil, fmt.Errorf("malformed symbol table, invalid number of aux symbols")
|
||||
}
|
||||
sym.SectionNumber = int(se.Nscnum)
|
||||
sym.StorageClass = int(se.Nsclass)
|
||||
sym.Value = uint64(se.Nvalue)
|
||||
@ -303,6 +306,9 @@ func NewFile(r io.ReaderAt) (*File, error) {
|
||||
return nil, err
|
||||
}
|
||||
numaux = int(se.Nnumaux)
|
||||
if numaux < 0 {
|
||||
return nil, fmt.Errorf("malformed symbol table, invalid number of aux symbols")
|
||||
}
|
||||
sym.SectionNumber = int(se.Nscnum)
|
||||
sym.StorageClass = int(se.Nsclass)
|
||||
sym.Value = se.Nvalue
|
||||
|
Loading…
Reference in New Issue
Block a user