diff --git a/src/cmd/6l/pass.c b/src/cmd/6l/pass.c index a2a82a18b5f..8dc0ed551b6 100644 --- a/src/cmd/6l/pass.c +++ b/src/cmd/6l/pass.c @@ -469,7 +469,7 @@ dostkoff(void) /* 160 comes from 3 calls (3*8) 4 safes (4*8) and 104 guard */ moreconst1 = 0; - if(autoffset+160 > 4096) + if(autoffset+160+textarg > 4096) moreconst1 = (autoffset+160) & ~7LL; moreconst2 = textarg; diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index d898b30b37d..b07b6d67c4d 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -749,6 +749,8 @@ newstack(void) args = m->moreargs; g1 = m->curg; + if(m->morebuf.sp < g1->stackguard - StackGuard) + throw("split stack overflow"); if(frame == 1 && args > 0 && m->morebuf.sp - sizeof(Stktop) - args - 32 > g1->stackguard) { // special case: called from reflect.call (frame == 1)