aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2018-02-28 22:01:24 -0800
committerJosh Bleecher Snyder <josharian@gmail.com>2018-03-01 16:53:33 +0000
commitaa9c1a8f8038e88da6d7cbfdc56e34ff914b7b04 (patch)
treefdc360731de1cd8fe5d6464f80a3249f951a7c50 /src/runtime
parent77ba071ec6aef921eaaa50f84479bb1a9e15a268 (diff)
downloadgo-aa9c1a8f8038e88da6d7cbfdc56e34ff914b7b04.tar.xz
runtime: fix amd64p32 indexbytes in presence of overflow
When the slice/string length is very large, probably artifically large as in CL 97523, adding BX (length) to R11 (pointer) overflows. As a result, checking DI < R11 yields the wrong result. Since they will be equal when the loop is done, just check DI != R11 instead. Yes, the pointer itself could overflow, but if that happens, something else has gone pretty wrong; not our concern here. Fixes #24187 Change-Id: I2f60fc6ccae739345d01bc80528560726ad4f8c6 Reviewed-on: https://go-review.googlesource.com/97802 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/asm_amd64p32.s2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/asm_amd64p32.s b/src/runtime/asm_amd64p32.s
index a59ba6ad91..dc4c57de13 100644
--- a/src/runtime/asm_amd64p32.s
+++ b/src/runtime/asm_amd64p32.s
@@ -904,7 +904,7 @@ sse:
condition:
CMPL DI, R11
- JLT sse
+ JNE sse
// search the end
MOVL SI, CX