diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b773903757..63805d39d8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,14 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ * source/pp/ppcore.c + + * source/compiler/harbour.l + * fixed compilation of macro expression (the first letter + was eaten in some cases) + + + * source/pp/ppcore.c + * source/pp/pplib.c * fixed calls to hb_pp_ParseDirective * increased back the input buffer to HB_PP_STR_SIZE (12288 bytes) diff --git a/harbour/include/hbpp.h b/harbour/include/hbpp.h index 1f4a5133ec..1a7b3d0209 100644 --- a/harbour/include/hbpp.h +++ b/harbour/include/hbpp.h @@ -113,7 +113,7 @@ extern char * hb_pp_szErrors[]; extern char * hb_pp_szWarnings[]; extern int hb_pp_nEmptyStrings; extern int hb_pp_LastOutLine; -extern BOOL hb_pp_StreamBlock; +extern int hb_pp_StreamBlock; extern BOOL hb_pp_NestedLiteralString; extern BOOL hb_pp_LiteralEscSeq; extern unsigned int hb_pp_MaxTranslateCycles; diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 61c8b722fb..837df28dea 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -2137,7 +2137,7 @@ static int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, BOOL char *expreal = ( char * ) hb_xgrab( MAX_EXP ); char *exppatt = ( char * ) hb_xgrab( MAX_NAME ); #endif - int lenreal = 0, maxlenreal = HB_PP_STR_SIZE, lenpatt; + int lenreal = 0, maxlenreal = MAX_EXP/*HB_PP_STR_SIZE*/, lenpatt; int rezrestr, ipos, nBra; char *ptr, *ptrtemp; @@ -2211,7 +2211,7 @@ static int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, BOOL } else { - maxlenreal = ipos - 1; + maxlenreal = ipos; lenreal = 0; } } @@ -2900,6 +2900,10 @@ static int getExpReal( char *expreal, char **ptri, BOOL prlist, int maxrez, BOOL lens++; } } + if( !rez && lens >= maxrez ) + { + hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_BUFFER_OVERFLOW, NULL, NULL ); + } if( expreal != NULL && expreal > cStart ) { @@ -3220,7 +3224,15 @@ static void SearnRep( char *exppatt, char *expreal, int lenreal, char *ptro, int { lennew = ptr2 - ptr - 1; - memcpy( expnew, ptr + 1, lennew ); + if( lennew < MAX_EXP ) + { + memcpy( expnew, ptr + 1, lennew ); + } + else + { + hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_BUFFER_OVERFLOW, NULL, NULL ); + return; + } *( expnew + lennew++ ) = ' '; *( expnew + lennew ) = '\0'; while( ( i = hb_strAt( exppatt, 2, expnew, lennew ) ) > 0 )