Skip to content

Commit

Permalink
Fix stack overflow of new coctx_make
Browse files Browse the repository at this point in the history
  • Loading branch information
princewen committed Dec 9, 2019
1 parent 6c896ce commit c79e3e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion coctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ int coctx_make(coctx_t* ctx, coctx_pfn_t pfn, const void* s, const void* s1) {
#elif defined(__x86_64__)
int coctx_make(coctx_t* ctx, coctx_pfn_t pfn, const void* s, const void* s1) {
char* sp = ctx->ss_sp + ctx->ss_size;
sp = (char*)((unsigned long)sp & -16LL);
sp = (char*)((unsigned long)sp & -16LL) - sizeof(void*);

memset(ctx->regs, 0, sizeof(ctx->regs));
void** ret_addr = (void**)(sp);
Expand Down

0 comments on commit c79e3e8

Please sign in to comment.