]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj/wasm: avoid invalid offsets for Load/Store
authorRichard Musiol <mail@richard-musiol.de>
Mon, 7 May 2018 14:18:19 +0000 (16:18 +0200)
committerCherry Zhang <cherryyz@google.com>
Thu, 10 May 2018 12:05:17 +0000 (12:05 +0000)
commitbf23a4e61ddceb26744da8f462ce6351fca66089
treed8729a64a59e3d2b0fcbea43ff1a6239bb26e594
parent10529a01fd8b0d5cc07eb3f6aa00a0272597684b
cmd/internal/obj/wasm: avoid invalid offsets for Load/Store

Offsets for Load and Store instructions have type i32. Bad index
expression offsets can cause an offset to be larger than MaxUint32,
which is not allowed. One example for this is the test test/index0.go.

Generate valid code by adding a guard to the responsible rewrite rule.
Also emit a proper error when using such a bad index in assembly code.

Change-Id: Ie90adcbf3ae3861c26680eb81790f28692913ccf
Reviewed-on: https://go-review.googlesource.com/111955
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/ssa/gen/Wasm.rules
src/cmd/compile/internal/ssa/rewriteWasm.go
src/cmd/internal/obj/wasm/wasmobj.go