Skip to content

Commit

Permalink
store SIGSEGV signal handler to return it in the next call
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbssa committed Feb 25, 2024
1 parent b33ad28 commit 0c6e8b4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion heob-inj.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ typedef struct localData
HMODULE msvcrt;
HMODULE ucrtbase;

// SIGSEGV handler set by signal(), returned by the next call
void *crtSigSegvHandler;

splitAllocation *splits;
int ptrShift;
allocType newArrAllocMethod;
Expand Down Expand Up @@ -1267,7 +1270,11 @@ static void *new_signal( int sig,void (*func)(int) )
GET_REMOTEDATA( rd );

if( rd->opt.handleException && sig==11 ) // SIGSEGV
return( (void*)0 ); // SIG_DFL
{
void *prevSigSegvHandler = rd->crtSigSegvHandler;
rd->crtSigSegvHandler = func;
return( prevSigSegvHandler );
}

return( rd->fsignal(sig,func) );
}
Expand Down

0 comments on commit 0c6e8b4

Please sign in to comment.