Kaydet (Commit) dbff5bd4 authored tarafından Caolán McNamara's avatar Caolán McNamara

CID#736166 unlikely out of bounds

Change-Id: I8a0f97be1723766df9f8fe287417365febf54966
üst 463bf087
...@@ -350,7 +350,10 @@ void SbiSymDef::SetType( SbxDataType t ) ...@@ -350,7 +350,10 @@ void SbiSymDef::SetType( SbxDataType t )
unsigned char c = (unsigned char)ch2; unsigned char c = (unsigned char)ch2;
if( c > 0 && c < 128 ) if( c > 0 && c < 128 )
{ {
t = pIn->pParser->eDefTypes[ ch2 - 'A' ]; int nIndex = ch2 - 'A';
assert(nIndex >= 0 && nIndex < N_DEF_TYPES);
if (nIndex >= 0 && nIndex < N_DEF_TYPES)
t = pIn->pParser->eDefTypes[nIndex];
} }
} }
} }
......
...@@ -77,7 +77,8 @@ public: ...@@ -77,7 +77,8 @@ public:
bool bClassModule; // true: OPTION ClassModule bool bClassModule; // true: OPTION ClassModule
StringVector aIfaceVector; // Holds all interfaces implemented by a class module StringVector aIfaceVector; // Holds all interfaces implemented by a class module
StringVector aRequiredTypes; // Types used in Dim As New <type> outside subs StringVector aRequiredTypes; // Types used in Dim As New <type> outside subs
SbxDataType eDefTypes[26]; // DEFxxx data types # define N_DEF_TYPES 26
SbxDataType eDefTypes[N_DEF_TYPES]; // DEFxxx data types
SbiParser( StarBASIC*, SbModule* ); SbiParser( StarBASIC*, SbModule* );
bool Parse(); bool Parse();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment