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>
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)
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