diff options
author | Than McIntosh <thanm@google.com> | 2022-04-25 11:22:10 -0400 |
---|---|---|
committer | Than McIntosh <thanm@google.com> | 2022-04-25 15:42:53 +0000 |
commit | 94f25ec94920beee5fb2dd4c0cbf4cbff28f14e6 (patch) | |
tree | 877307a67b1e2ffa5b5da02421540aab1fc84e6a | |
parent | 6b1d9aefa8fce9f9c83f46193bec43b9b70068ce (diff) | |
download | go-94f25ec94920beee5fb2dd4c0cbf4cbff28f14e6.tar.gz go-94f25ec94920beee5fb2dd4c0cbf4cbff28f14e6.zip |
debug/pe: fix off by one error in valid symbol index test
Fix an off-by-one error in COFFSymbolReadSectionDefAux, specifically
the code that tests whether a symbol index is valid.
Fixes #52525.
Change-Id: I1b6e5dacfd99249c694bef5ae606e90fdb2ef521
Reviewed-on: https://go-review.googlesource.com/c/go/+/402156
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
-rw-r--r-- | src/debug/pe/symbol.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/debug/pe/symbol.go b/src/debug/pe/symbol.go index 0dfd5d90b8..323fa8c3df 100644 --- a/src/debug/pe/symbol.go +++ b/src/debug/pe/symbol.go @@ -136,10 +136,9 @@ const ( // auxiliary symbols: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#auxiliary-symbol-records // COMDAT sections: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#comdat-sections-object-only // auxiliary info for section definitions: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#auxiliary-format-5-section-definitions -// func (f *File) COFFSymbolReadSectionDefAux(idx int) (*COFFSymbolAuxFormat5, error) { var rv *COFFSymbolAuxFormat5 - if idx < 0 || idx > len(f.COFFSymbols) { + if idx < 0 || idx >= len(f.COFFSymbols) { return rv, fmt.Errorf("invalid symbol index") } pesym := &f.COFFSymbols[idx] |