From 4e312b9f645410cd5d91a17a5524655bfa248c0b Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 16 Mar 2016 14:40:37 -0400 Subject: [PATCH] libCom: exitWait() from thread exit handler corrupts stack The epicsThreadCallEntryPoint() function stores a pointer to a local variable in epicsThread::pWaitReleaseFlag. Calling epicsAtThreadExit::exitWait() from that thread's epicsAtThreadExit() handler writes to this pointer after epicsThreadCallEntryPoint() has returned. Thus corrupting the stack. Set pWaitReleaseFlag=NULL before return to prevent this. fixes lp:1558206 --- src/libCom/osi/epicsThread.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libCom/osi/epicsThread.cpp b/src/libCom/osi/epicsThread.cpp index ed016f47e..a4124c216 100644 --- a/src/libCom/osi/epicsThread.cpp +++ b/src/libCom/osi/epicsThread.cpp @@ -109,6 +109,7 @@ extern "C" void epicsThreadCallEntryPoint ( void * pPvt ) // once the terminated flag is set and we release the lock // then the "this" pointer must not be touched again } + pThread->pWaitReleaseFlag = NULL; } bool epicsThread::beginWait () throw ()