BaseTools/TianoCompress: Add checks for array access

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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>
This commit is contained in:
Hao Wu 2016-10-11 11:17:46 +08:00
parent b3520abde8
commit 5acc8d3cdd
1 changed files with 3 additions and 1 deletions

View File

@ -2215,7 +2215,7 @@ Returns:
for (Char = 0; Char < NumOfChar; Char++) { for (Char = 0; Char < NumOfChar; Char++) {
Len = BitLen[Char]; Len = BitLen[Char];
if (Len == 0) { if (Len == 0 || Len >= 17) {
continue; continue;
} }
@ -2346,6 +2346,8 @@ Returns:
volatile UINT16 Index; volatile UINT16 Index;
UINT32 Mask; UINT32 Mask;
assert (nn <= NPT);
Number = (UINT16) GetBits (Sd, nbit); Number = (UINT16) GetBits (Sd, nbit);
if (Number == 0) { if (Number == 0) {