diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ade161ca17..c6d12b7be4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,17 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-01-29 02:16 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/common/hbprintf.c + * minor modification for easier future updating + + * harbour/source/rdd/dbfntx/dbfntx1.c + ! fixed possible GPF caused by corrupted indexes + + * harbour/source/rdd/dbfcdx/dbfcdx1.c + ! fixed possible GPF caused by missing RT error + ! added RT errors for invalid KEY or FOR expressions + 2009-01-28 22:28 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/vm/itemapi.c % eliminated hb_snpritf() from HB_IT_POINTER conversion in diff --git a/harbour/source/common/hbprintf.c b/harbour/source/common/hbprintf.c index 6b953155e5..463c68cce9 100644 --- a/harbour/source/common/hbprintf.c +++ b/harbour/source/common/hbprintf.c @@ -123,6 +123,14 @@ HB_EXTERN_END # define __NO_LONGLONG__ #endif +#ifndef va_copy +# ifdef __va_copy +# define va_copy( dst, src ) __va_copy( dst, src ) +# else +# define va_copy( dst, src ) ( (dst) = (src) ) +# endif +#endif + /* few macros for some platform dependent floating point functions/macros */ #define _HB_NUM_NAN 1 @@ -943,7 +951,7 @@ int hb_snprintf_c( char * buffer, size_t bufsize, const char * format, ... ) /* else error, wrong format */ } else - width = va_arg( args, int ); + width = va_arg_n( args, _x_int, 0 ); } else if( c >= '0' && c <= '9' ) c = get_decimal( c, &format, &width ); @@ -967,7 +975,7 @@ int hb_snprintf_c( char * buffer, size_t bufsize, const char * format, ... ) /* else error, wrong format */ } else - precision = va_arg( args, int ); + precision = va_arg_n( args, _x_int, 0 ); } else if( c >= '0' && c <= '9' ) c = get_decimal( c, &format, &precision ); diff --git a/harbour/source/rdd/dbfcdx/dbfcdx1.c b/harbour/source/rdd/dbfcdx/dbfcdx1.c index a2a7b74597..36374c52af 100644 --- a/harbour/source/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/source/rdd/dbfcdx/dbfcdx1.c @@ -3572,10 +3572,10 @@ static void hb_cdxTagLoad( LPCDXTAG pTag ) pTag->AscendKey = pTag->UsrAscend = ( HB_GET_LE_UINT16( tagHeader.ascendFlg ) == 0 ); pTag->UsrUnique = FALSE; - if ( pTag->OptFlags & CDX_TYPE_STRUCTURE || ! *pTag->KeyExpr ) + if( pTag->OptFlags & CDX_TYPE_STRUCTURE ) return; - if ( SELF_COMPILE( ( AREAP ) pTag->pIndex->pArea, ( BYTE * ) pTag->KeyExpr ) == FAILURE ) + if( !*pTag->KeyExpr || SELF_COMPILE( ( AREAP ) pTag->pIndex->pArea, ( BYTE * ) pTag->KeyExpr ) == FAILURE ) { pTag->RootBlock = 0; /* To force RT error - index corrupted */ return; @@ -7457,7 +7457,10 @@ static ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo } if( SELF_COMPILE( (AREAP) pArea, ( BYTE * ) hb_itemGetCPtr( pOrderInfo->abExpr ) ) == FAILURE ) + { + hb_cdxErrorRT( pArea, EG_DATATYPE, EDBF_INVALIDKEY, NULL, 0, 0, NULL ); return FAILURE; + } pKeyExp = pArea->valResult; pArea->valResult = NULL; @@ -7539,6 +7542,7 @@ static ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo { hb_vmDestroyBlockOrMacro( pKeyExp ); SELF_GOTO( ( AREAP ) pArea, ulRecNo ); + hb_cdxErrorRT( pArea, EG_DATATYPE, EDBF_INVALIDFOR, NULL, 0, 0, NULL ); return FAILURE; } pForExp = pArea->valResult; diff --git a/harbour/source/rdd/dbfntx/dbfntx1.c b/harbour/source/rdd/dbfntx/dbfntx1.c index 620fbe8cc8..3b458a431c 100644 --- a/harbour/source/rdd/dbfntx/dbfntx1.c +++ b/harbour/source/rdd/dbfntx/dbfntx1.c @@ -1972,6 +1972,7 @@ static void hb_ntxIndexFlush( LPNTXINDEX pIndex ) { hb_ntxPageSave( pIndex, pPage ); ++pPage->iUsed; + /* hack */ hb_ntxPageRelease( pIndex->lpTags[0], pPage ); } else @@ -1988,7 +1989,7 @@ static void hb_ntxIndexFlush( LPNTXINDEX pIndex ) if( pIndex->Changed ) hb_ntxIndexHeaderSave( pIndex ); } - else + else if( pIndex->iTags ) { if( pIndex->Changed || pIndex->lpTags[ 0 ]->HdrChanged ) hb_ntxTagHeaderSave( pIndex->lpTags[ 0 ] );