2008-09-18 20:41 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/vm/thread.c
    * detach local parameters passed by reference to hb_threadStart()
      to avoid possible calling thread HVM stack corruption
This commit is contained in:
Przemyslaw Czerpak
2008-09-18 18:42:15 +00:00
parent c92f2bec7b
commit a6f735db01
2 changed files with 15 additions and 0 deletions

View File

@@ -8,6 +8,11 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-09-18 20:41 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/thread.c
* detach local parameters passed by reference to hb_threadStart()
to avoid possible calling thread HVM stack corruption
2008-09-18 19:28 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rdd/dbfcdx/dbfcdx1.c
! fixed memory leak - Many thanks to Miguel for report

View File

@@ -513,6 +513,7 @@ HB_FUNC( HB_THREADSTART )
{
PHB_ITEM pReturn;
PHB_THREADSTATE pThread;
ULONG ulPCount, ulParam;
pReturn = hb_itemNew( NULL );
pThread = ( PHB_THREADSTATE )
@@ -526,6 +527,15 @@ HB_FUNC( HB_THREADSTART )
pThread->pSet = hb_setClone( hb_stackSetStruct() );
pThread->pParams = hb_arrayBaseParams();
/* detach LOCAL variables passed by reference */
ulPCount = hb_arrayLen( pThread->pParams );
for( ulParam = 2; ulParam <= ulPCount; ++ulParam )
{
PHB_ITEM pParam = hb_arrayGetItemPtr( pThread->pParams, ulParam );
if( HB_IS_BYREF( pParam ) )
hb_memvarDetachLocal( pParam );
}
/* make copy of thread pointer item before we pass it to new thread
* to avoid race condition
*/