summaryrefslogtreecommitdiff
path: root/BaseTools/Source/C/VfrCompile/Pccts
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2016-10-11 11:21:31 +0800
committerHao Wu <hao.a.wu@intel.com>2016-11-08 16:37:07 +0800
commitbab5ad2fd14bf8d1e9e688327a11136c8bfb523e (patch)
treedcc42ad99b7d0b167cce1ef8b3b8d37a13a4e89c /BaseTools/Source/C/VfrCompile/Pccts
parent5acc8d3cdd280f00ab316023e1f77dbce6025eb4 (diff)
downloadedk2-platforms-bab5ad2fd14bf8d1e9e688327a11136c8bfb523e.tar.xz
BaseTools/VfrCompile: Add checks for array access
Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/C/VfrCompile/Pccts')
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/h/DLexer.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/h/DLexer.h b/BaseTools/Source/C/VfrCompile/Pccts/h/DLexer.h
index 37cac24f14..f15bff1187 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/h/DLexer.h
+++ b/BaseTools/Source/C/VfrCompile/Pccts/h/DLexer.h
@@ -30,6 +30,8 @@
* 1989-2000
*/
+#include <assert.h>
+
#define ZZINC {if ( track_columns ) (++_endcol);}
#define ZZGETC {ch = input->nextChar(); cl = ZZSHIFT(ch);}
@@ -114,6 +116,7 @@ more:
state = dfa_base[automaton];
while (ZZNEWSTATE != DfaStates) {
state = newstate;
+ assert(state <= sizeof(dfa)/sizeof(dfa[0]));
ZZCOPY;
ZZGETC;
ZZINC;