From 9cb8e490220684e9eec9fad303af66c73ae002c9 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sat, 31 Oct 2009 11:44:18 +0000 Subject: [PATCH] 2009-10-31 12:44 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rdd/dbfcdx/dbfcdx1.c % added small protection against code which may want to create degenerated index tree using very large keys (over 158 bytes length) --- harbour/ChangeLog | 5 +++++ harbour/src/rdd/dbfcdx/dbfcdx1.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0030899576..0d6d32b536 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,11 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-10-31 12:44 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/rdd/dbfcdx/dbfcdx1.c + % added small protection against code which may want to create + degenerated index tree using very large keys (over 158 bytes length) + 2009-10-31 10:45 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + w64-make.exe + Added win64 build of GNU Make 3.81.90-CVS-20090901. diff --git a/harbour/src/rdd/dbfcdx/dbfcdx1.c b/harbour/src/rdd/dbfcdx/dbfcdx1.c index 0af67c15ba..59bceef451 100644 --- a/harbour/src/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/src/rdd/dbfcdx/dbfcdx1.c @@ -3221,10 +3221,13 @@ static int hb_cdxPageKeyIntBalance( LPCDXPAGE pPage, int iChildRet ) */ if( iKeys > 0 ) { + fForce = pPage->TagParent->MaxKeys == 2 && iBlncKeys > 2 && + iKeys == ( iBlncKeys << 1 ) - 1; pPtr = pKeyPool; for( i = 0; i < iBlncKeys; i++ ) { - iNodeKeys = ( iKeys + iBlncKeys - i - 1 ) / ( iBlncKeys - i ); + iNodeKeys = ( fForce && i == 1 ) ? 1 : + ( ( iKeys + iBlncKeys - i - 1 ) / ( iBlncKeys - i ) ); #ifdef HB_CDX_DBGCODE if( iNodeKeys > pPage->TagParent->MaxKeys ) hb_cdxErrInternal( "hb_cdxPageKeyIntBalance: iNodeKeys calculated wrong!." );