diff --git a/ChangeLog.txt b/ChangeLog.txt index a8ec2651fd..7ef01dd685 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,15 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2020-04-19 16:00 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * src/vm/dynsym.c + * src/vm/task.c + ! pacified warnings + + * src/vm/hashfunc.c + ! fixed possible GPF in hb_HCopy() and hb_HMerge() functions when source + and destinnation is the same hash array. + 2020-03-27 15:00 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * ChangeLog.txt ! fixed the position of my last ChangeLog entry - sorry but my script diff --git a/src/vm/dynsym.c b/src/vm/dynsym.c index 80e13cc34d..cc09b66b1b 100644 --- a/src/vm/dynsym.c +++ b/src/vm/dynsym.c @@ -510,7 +510,7 @@ static PHB_DYNS hb_dynsymGetByIndex( HB_LONG lIndex ) HB_DYNSYM_LOCK(); - if( lIndex >= 1 && lIndex <= s_uiDynSymbols ) + if( lIndex >= 1 && ( HB_ULONG ) lIndex <= s_uiDynSymbols ) pDynSym = s_pDynItems[ lIndex - 1 ].pDynSym; HB_DYNSYM_UNLOCK(); diff --git a/src/vm/hashfunc.c b/src/vm/hashfunc.c index 474e48ccb0..3eb8be76a6 100644 --- a/src/vm/hashfunc.c +++ b/src/vm/hashfunc.c @@ -379,24 +379,26 @@ HB_FUNC( HB_HCOPY ) if( pSource && pDest ) { - HB_SIZE nLen = hb_hashLen( pSource ), nStart, nCount; - - nStart = hb_parns( 3 ); - if( ! nStart ) - ++nStart; - nCount = HB_ISNUM( 4 ) ? ( HB_SIZE ) hb_parns( 4 ) : nLen - nStart + 1; - - while( nCount-- ) + if( pSource != pDest ) { - PHB_ITEM pKey = hb_hashGetKeyAt( pSource, nStart ); - PHB_ITEM pValue = hb_hashGetValueAt( pSource, nStart ); - if( pKey && pValue ) - hb_hashAdd( pDest, pKey, pValue ); - else - break; - ++nStart; - } + HB_SIZE nLen = hb_hashLen( pSource ), nStart, nCount; + nStart = hb_parns( 3 ); + if( ! nStart ) + ++nStart; + nCount = HB_ISNUM( 4 ) ? ( HB_SIZE ) hb_parns( 4 ) : nLen - nStart + 1; + + while( nCount-- ) + { + PHB_ITEM pKey = hb_hashGetKeyAt( pSource, nStart ); + PHB_ITEM pValue = hb_hashGetValueAt( pSource, nStart ); + if( pKey && pValue ) + hb_hashAdd( pDest, pKey, pValue ); + else + break; + ++nStart; + } + } hb_itemReturn( pDest ); } else @@ -410,36 +412,38 @@ HB_FUNC( HB_HMERGE ) if( pDest && pSource ) { - PHB_ITEM pAction = hb_param( 3, HB_IT_EVALITEM | HB_IT_NUMERIC ); - - if( pAction && HB_IS_EVALITEM( pAction ) ) + if( pSource != pDest ) { - HB_SIZE nLen = hb_hashLen( pSource ), nPos = 0; - while( ++nPos <= nLen ) - { - PHB_ITEM pKey = hb_hashGetKeyAt( pSource, nPos ); - PHB_ITEM pValue = hb_hashGetValueAt( pSource, nPos ); - if( pKey && pValue ) - { - hb_vmPushEvalSym(); - hb_vmPush( pAction ); - hb_vmPush( pKey ); - hb_vmPush( pValue ); - hb_vmPushSize( nPos ); - hb_vmSend( 3 ); - { - PHB_ITEM pReturn = hb_stackReturnItem(); - if( HB_IS_LOGICAL( pReturn ) && hb_itemGetL( pReturn ) ) - hb_hashAdd( pDest, pKey, pValue ); - } - } - else - break; - } - } - else - hb_hashJoin( pDest, pSource, pAction ? hb_itemGetNI( pAction ) : HB_HASH_UNION ); + PHB_ITEM pAction = hb_param( 3, HB_IT_EVALITEM | HB_IT_NUMERIC ); + if( pAction && HB_IS_EVALITEM( pAction ) ) + { + HB_SIZE nLen = hb_hashLen( pSource ), nPos = 0; + while( ++nPos <= nLen ) + { + PHB_ITEM pKey = hb_hashGetKeyAt( pSource, nPos ); + PHB_ITEM pValue = hb_hashGetValueAt( pSource, nPos ); + if( pKey && pValue ) + { + hb_vmPushEvalSym(); + hb_vmPush( pAction ); + hb_vmPush( pKey ); + hb_vmPush( pValue ); + hb_vmPushSize( nPos ); + hb_vmSend( 3 ); + { + PHB_ITEM pReturn = hb_stackReturnItem(); + if( HB_IS_LOGICAL( pReturn ) && hb_itemGetL( pReturn ) ) + hb_hashAdd( pDest, pKey, pValue ); + } + } + else + break; + } + } + else + hb_hashJoin( pDest, pSource, pAction ? hb_itemGetNI( pAction ) : HB_HASH_UNION ); + } hb_itemReturn( pDest ); } else diff --git a/src/vm/task.c b/src/vm/task.c index 3376ccbb9f..891b4e9f6a 100644 --- a/src/vm/task.c +++ b/src/vm/task.c @@ -756,6 +756,7 @@ void hb_taskResume( void * pTaskPtr ) #if defined( HB_HAS_UCONTEXT ) case TASK_INIT: #endif + /* fallthrough */ case TASK_SUSPEND: pTask->state = TASK_RUNNING; /* fallthrough */