summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd/ld/data.c6
-rw-r--r--src/cmd/ld/lib.c1
2 files changed, 6 insertions, 1 deletions
diff --git a/src/cmd/ld/data.c b/src/cmd/ld/data.c
index db2ac0f46..30d7c8185 100644
--- a/src/cmd/ld/data.c
+++ b/src/cmd/ld/data.c
@@ -376,6 +376,12 @@ symgrow(Sym *s, int32 siz)
if(s->np >= siz)
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 == 0)
s->maxp = 8;
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c
index c400c622f..7639615b4 100644
--- a/src/cmd/ld/lib.c
+++ b/src/cmd/ld/lib.c
@@ -2348,7 +2348,6 @@ ftabaddstring(Sym *ftab, char *s)
start = ftab->np;
symgrow(ftab, start+n+1);
strcpy((char*)ftab->p + start, s);
- ftab->np += n+1;
return start;
}