1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0024897: Possibility of uncontrolled exit if scanner fails in ExprIntrp

Macro YY_FATAL_ERROR() is defined in ExprIntrp.lex in order to have exception instead of program exit in case of scanner error. Fixed-length string buffers are replaced by TCollection_AsciiString to avoid buffer overflow.
Some code refactoring: declarations of functions moved to header file, unused global declarations and variables removed, compiler warnings fixed or disabled, obsolete EDL file removed.
Test case for issue CR24897
Correction of MSVC compiler warning when scanner is generated using Flex 2.5.35 on Linux
This commit is contained in:
abv
2014-05-29 15:05:47 +04:00
committed by apn
parent cae42e78e5
commit 2a54ebbf29
10 changed files with 87 additions and 112 deletions

View File

@@ -17,7 +17,7 @@
#include <string.h>
#include <ExprIntrp_yaccintrf.hxx>
static char ExprIntrp_curres[255];
static TCollection_AsciiString ExprIntrp_curres;
static int ExprIntrp_degree;
#ifndef WNT
@@ -29,7 +29,7 @@ extern "C" char* ExprIntrptext;
extern "C" void ExprIntrp_SetResult()
{
strcpy(ExprIntrp_curres,ExprIntrptext);
ExprIntrp_curres = ExprIntrptext;
}
extern "C" void ExprIntrp_SetDegree()
@@ -42,8 +42,7 @@ int ExprIntrp_GetDegree()
return ExprIntrp_degree;
}
int ExprIntrp_GetResult(char *s)
const TCollection_AsciiString& ExprIntrp_GetResult ()
{
strcpy(s,ExprIntrp_curres);
return (int)strlen(ExprIntrp_curres);
return ExprIntrp_curres;
}