Commit 6111dc4e authored by Ian Lance Taylor's avatar Ian Lance Taylor

liblink: check for symgrow size too large

Many calls to symgrow pass a vlong value.  Change the function
to not implicitly truncate, and to instead give an error if
the value is too large.

R=golang-codereviews, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/54010043
parent cb133c66
...@@ -500,7 +500,7 @@ vlong setuint32(Link *ctxt, LSym *s, vlong r, uint32 v); ...@@ -500,7 +500,7 @@ vlong setuint32(Link *ctxt, LSym *s, vlong r, uint32 v);
vlong setuint64(Link *ctxt, LSym *s, vlong r, uint64 v); vlong setuint64(Link *ctxt, LSym *s, vlong r, uint64 v);
vlong setuint8(Link *ctxt, LSym *s, vlong r, uint8 v); vlong setuint8(Link *ctxt, LSym *s, vlong r, uint8 v);
vlong setuintxx(Link *ctxt, LSym *s, vlong off, uint64 v, vlong wid); vlong setuintxx(Link *ctxt, LSym *s, vlong off, uint64 v, vlong wid);
void symgrow(Link *ctxt, LSym *s, int32 siz); void symgrow(Link *ctxt, LSym *s, vlong siz);
// go.c // go.c
void double2ieee(uint64 *ieee, double native); void double2ieee(uint64 *ieee, double native);
......
...@@ -41,10 +41,16 @@ mangle(char *file) ...@@ -41,10 +41,16 @@ mangle(char *file)
} }
void void
symgrow(Link *ctxt, LSym *s, int32 siz) symgrow(Link *ctxt, LSym *s, vlong lsiz)
{ {
int32 siz;
USED(ctxt); USED(ctxt);
siz = (int32)lsiz;
if((vlong)siz != lsiz)
sysfatal("symgrow size %lld too long", lsiz);
if(s->np >= siz) if(s->np >= siz)
return; return;
......
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