Commit d011f0aa authored by Ian Lance Taylor's avatar Ian Lance Taylor

cmd/ld: don't allocate unused garbage space in pclntab file table

Fixes #6319.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13539043
parent 97d6a1e1
...@@ -376,6 +376,12 @@ symgrow(Sym *s, int32 siz) ...@@ -376,6 +376,12 @@ symgrow(Sym *s, int32 siz)
if(s->np >= siz) if(s->np >= siz)
return; return;
if(s->np > s->maxp) {
cursym = s;
diag("corrupt symbol data: np=%lld > maxp=%lld", (vlong)s->np, (vlong)s->maxp);
errorexit();
}
if(s->maxp < siz) { if(s->maxp < siz) {
if(s->maxp == 0) if(s->maxp == 0)
s->maxp = 8; s->maxp = 8;
......
...@@ -2348,7 +2348,6 @@ ftabaddstring(Sym *ftab, char *s) ...@@ -2348,7 +2348,6 @@ ftabaddstring(Sym *ftab, char *s)
start = ftab->np; start = ftab->np;
symgrow(ftab, start+n+1); symgrow(ftab, start+n+1);
strcpy((char*)ftab->p + start, s); strcpy((char*)ftab->p + start, s);
ftab->np += n+1;
return start; return start;
} }
......
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