aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLynn Boger <laboger@linux.vnet.ibm.com>2019-10-28 09:29:40 -0400
committerCarlos Amedee <carlos@golang.org>2019-12-04 17:11:12 +0000
commit7b63a56ed3c4e316f32c29218579eab10164ddc5 (patch)
tree95e063180ba8bbcaa03045053968ebd7271302f2
parent8d72096bbf140295d47a06fc59e75d1feafce60e (diff)
downloadgo-7b63a56ed3c4e316f32c29218579eab10164ddc5.tar.gz
go-7b63a56ed3c4e316f32c29218579eab10164ddc5.zip
[release-branch.go1.12] runtime: fix textOff for multiple text sections
If a compilation has multiple text sections, code in textOff must compare the offset argument against the range for each text section to determine which one it is in. The comparison looks like this: if uintptr(off) >= sectaddr && uintptr(off) <= sectaddr+sectlen If the off value being compared is equal to sectaddr+sectlen then it is not within the range of the text section but after it. The comparison should be just '<'. Fixes #35210 Change-Id: I114633fd734563d38f4e842dd884c6c239f73c95 Reviewed-on: https://go-review.googlesource.com/c/go/+/203817 Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> (cherry picked from commit 0ae9389609f23dc905c58fc2ad7bcc16b770f337) Reviewed-on: https://go-review.googlesource.com/c/go/+/203818 Run-TryBot: Carlos Amedee <carlos@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
-rw-r--r--src/runtime/type.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/type.go b/src/runtime/type.go
index f7f99924ea..a393da19f7 100644
--- a/src/runtime/type.go
+++ b/src/runtime/type.go
@@ -290,7 +290,7 @@ func (t *_type) textOff(off textOff) unsafe.Pointer {
for i := range md.textsectmap {
sectaddr := md.textsectmap[i].vaddr
sectlen := md.textsectmap[i].length
- if uintptr(off) >= sectaddr && uintptr(off) <= sectaddr+sectlen {
+ if uintptr(off) >= sectaddr && uintptr(off) < sectaddr+sectlen {
res = md.textsectmap[i].baseaddr + uintptr(off) - uintptr(md.textsectmap[i].vaddr)
break
}