]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix crash when memmove argument is not the right type
authorKeith Randall <keithr@alum.mit.edu>
Fri, 1 Feb 2019 23:27:53 +0000 (15:27 -0800)
committerKeith Randall <khr@golang.org>
Fri, 1 Feb 2019 23:43:09 +0000 (23:43 +0000)
commit8f854244ad5165c4ef9aa5760316b13233514e06
tree57cc295ef1c5007d95c2da81ad0f754740132e77
parent7e987b7b332fb21b56418351ce942d892f07481b
cmd/compile: fix crash when memmove argument is not the right type

Make sure the argument to memmove is of pointer type before we try to
get the element type.

This has been noticed for code that uses unsafe+linkname so it can
call runtime.memmove. Probably not the best thing to allow, but the
code is out there and we'd rather not break it unnecessarily.

Fixes #30061

Change-Id: I334a8453f2e293959fd742044c43fbe93f0b3d31
Reviewed-on: https://go-review.googlesource.com/c/160826
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/ssa/gen/generic.rules
src/cmd/compile/internal/ssa/rewritegeneric.go
test/fixedbugs/issue30061.go [new file with mode: 0644]