Commit 2978ebbc authored by Shenghou Ma's avatar Shenghou Ma Committed by Minux Ma

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: 's avatarShenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/3932Reviewed-by: 's avatarDave Cheney <dave@cheney.net>
Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent 0ca49135
......@@ -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))
......
......@@ -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))
......
......@@ -2398,7 +2398,7 @@ sudoaddable(int as, Node *n, Addr *a)
{
USED(as);
USED(n);
USED(a);
memset(a, 0, sizeof *a);
return 0;
}
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment