]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix uninitialized memory in compare of interface value
authorAustin Clements <austin@google.com>
Mon, 24 Aug 2015 17:35:49 +0000 (13:35 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 25 Aug 2015 14:37:08 +0000 (14:37 +0000)
commit05a3b1fce56a95e40512bae9f62656098f198834
tree0a5bb8ab10f462a7d7fe885f9b577252db651e2d
parent686d44d9e0c4e43716f8dd51ffaf81b8754f3620
cmd/compile: fix uninitialized memory in compare of interface value

A comparison of the form l == r where l is an interface and r is
concrete performs a type assertion on l to convert it to r's type.
However, the compiler fails to zero the temporary where the result of
the type assertion is written, so if the type is a pointer type and a
stack scan occurs while in the type assertion, it may see an invalid
pointer on the stack.

Fix this by zeroing the temporary. This is equivalent to the fix for
type switches from c4092ac.

Fixes #12253.

Change-Id: Iaf205d456b856c056b317b4e888ce892f0c555b9
Reviewed-on: https://go-review.googlesource.com/13872
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/compile/internal/gc/walk.go
src/runtime/export_test.go
src/runtime/gc_test.go
src/runtime/iface.go