1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:44:45 -07:00

cmd/5g, cmd/6g, cmd/8g, cmd/9g: clear Addr parameter in sudoaddable

The Addr might be a stack variable with uninitialized fields.

Fixes #9777.

Change-Id: I799786e3d8b2e17e069725bc66a076cf9ca11f93
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/3932
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Shenghou Ma 2015-02-04 23:38:45 -05:00 committed by Minux Ma
parent 0ca49135a0
commit 2978ebbc7b
4 changed files with 7 additions and 2 deletions

View File

@ -1812,6 +1812,8 @@ sudoaddable(int as, Node *n, Addr *a, int *w)
if(n->type == T)
return 0;
memset(a, 0, sizeof *a);
switch(n->op) {
case OLITERAL:
if(!isconst(n, CTINT))

View File

@ -1966,6 +1966,8 @@ sudoaddable(int as, Node *n, Addr *a)
if(n->type == T)
return 0;
memset(a, 0, sizeof *a);
switch(n->op) {
case OLITERAL:
if(!isconst(n, CTINT))

View File

@ -2398,7 +2398,7 @@ sudoaddable(int as, Node *n, Addr *a)
{
USED(as);
USED(n);
USED(a);
memset(a, 0, sizeof *a);
return 0;
}

View File

@ -1700,6 +1700,7 @@ int
sudoaddable(int as, Node *n, Addr *a)
{
// TODO(minux)
USED(as); USED(n); USED(a);
USED(as); USED(n);
memset(a, 0, sizeof *a);
return 0;
}