summaryrefslogtreecommitdiffstats
path: root/basic
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-09-12 12:31:43 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-09-12 13:09:05 +0100
commitdbff5bd4cd4eec4db844244d5ff431a3f2b1b82e (patch)
tree2712871a036c84ce76d07f94f7b5ce54601f4c33 /basic
parentCID#736167 unlikely out of bounds (diff)
downloadcore-dbff5bd4cd4eec4db844244d5ff431a3f2b1b82e.tar.gz
core-dbff5bd4cd4eec4db844244d5ff431a3f2b1b82e.zip
CID#736166 unlikely out of bounds
Change-Id: I8a0f97be1723766df9f8fe287417365febf54966
Diffstat (limited to 'basic')
-rw-r--r--basic/source/comp/symtbl.cxx5
-rw-r--r--basic/source/inc/parser.hxx3
2 files changed, 6 insertions, 2 deletions
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 0a5e3a22c04c..fccc044805f0 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -350,7 +350,10 @@ void SbiSymDef::SetType( SbxDataType t )
unsigned char c = (unsigned char)ch2;
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];
}
}
}
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
index a6f3751d8c57..27bb4fb0104f 100644
--- a/basic/source/inc/parser.hxx
+++ b/basic/source/inc/parser.hxx
@@ -77,7 +77,8 @@ public:
bool bClassModule; // true: OPTION ClassModule
StringVector aIfaceVector; // Holds all interfaces implemented by a class module
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* );
bool Parse();