From 5acc8d3cdd280f00ab316023e1f77dbce6025eb4 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Tue, 11 Oct 2016 11:17:46 +0800 Subject: [PATCH] BaseTools/TianoCompress: Add checks for array access Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu Reviewed-by: Liming Gao --- BaseTools/Source/C/TianoCompress/TianoCompress.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c b/BaseTools/Source/C/TianoCompress/TianoCompress.c index b994d933eb..93cb6c3ac3 100644 --- a/BaseTools/Source/C/TianoCompress/TianoCompress.c +++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c @@ -2215,7 +2215,7 @@ Returns: for (Char = 0; Char < NumOfChar; Char++) { Len = BitLen[Char]; - if (Len == 0) { + if (Len == 0 || Len >= 17) { continue; } @@ -2346,6 +2346,8 @@ Returns: volatile UINT16 Index; UINT32 Mask; + assert (nn <= NPT); + Number = (UINT16) GetBits (Sd, nbit); if (Number == 0) { -- 2.39.2