mirror of
https://github.com/golang/go
synced 2024-11-21 22:44:40 -07:00
5g: fix memory corruption
R=ken2 CC=golang-dev https://golang.org/cl/5666043
This commit is contained in:
parent
adb1a6ce3c
commit
1c987a321f
@ -346,7 +346,7 @@ anyregalloc(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uintptr regpc[REGALLOC_RMAX+1];
|
uintptr regpc[REGALLOC_FMAX+1];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* allocate register of type t, leave in n.
|
* allocate register of type t, leave in n.
|
||||||
@ -451,7 +451,7 @@ regfree(Node *n)
|
|||||||
if(n->op != OREGISTER && n->op != OINDREG)
|
if(n->op != OREGISTER && n->op != OINDREG)
|
||||||
fatal("regfree: not a register");
|
fatal("regfree: not a register");
|
||||||
i = n->val.u.reg;
|
i = n->val.u.reg;
|
||||||
if(i < 0 || i >= sizeof(reg))
|
if(i < 0 || i >= nelem(reg) || i >= nelem(regpc))
|
||||||
fatal("regfree: reg out of range");
|
fatal("regfree: reg out of range");
|
||||||
if(reg[i] <= 0)
|
if(reg[i] <= 0)
|
||||||
fatal("regfree: reg not allocated");
|
fatal("regfree: reg not allocated");
|
||||||
|
Loading…
Reference in New Issue
Block a user