diff options
author | Cherry Zhang <cherryyz@google.com> | 2021-02-01 16:46:49 -0500 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2021-02-02 15:59:11 +0000 |
commit | 1426a571b79bfcb3c0339e2fd96c893cd1549af6 (patch) | |
tree | 937f1b134458117a1636fa6f42fa00c776d69545 /src | |
parent | 32e789f4fb45b6296b9283ab80e126287eab4db5 (diff) | |
download | go-1426a571b79bfcb3c0339e2fd96c893cd1549af6.tar.gz go-1426a571b79bfcb3c0339e2fd96c893cd1549af6.zip |
cmd/link: fix off-by-1 error in findShlibSection
We want to find a section that contains addr. sect.Addr+sect.Size
is the exclusive upper bound.
Change-Id: If2cd6bdd6e03174680e066189b0f4bf9e2ba6630
Reviewed-on: https://go-review.googlesource.com/c/go/+/288592
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/link/internal/ld/decodesym.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/link/internal/ld/decodesym.go b/src/cmd/link/internal/ld/decodesym.go index c6e2d8ca7f..fc179fc6e4 100644 --- a/src/cmd/link/internal/ld/decodesym.go +++ b/src/cmd/link/internal/ld/decodesym.go @@ -279,7 +279,7 @@ func findShlibSection(ctxt *Link, path string, addr uint64) *elf.Section { for _, shlib := range ctxt.Shlibs { if shlib.Path == path { for _, sect := range shlib.File.Sections[1:] { // skip the NULL section - if sect.Addr <= addr && addr <= sect.Addr+sect.Size { + if sect.Addr <= addr && addr < sect.Addr+sect.Size { return sect } } |