summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/C/Common/Decompress.c
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/C/Common/Decompress.c')
-rw-r--r--BaseTools/Source/C/Common/Decompress.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/BaseTools/Source/C/Common/Decompress.c b/BaseTools/Source/C/Common/Decompress.c
index 0e9ba0a982..e9ac1d58b3 100644
--- a/BaseTools/Source/C/Common/Decompress.c
+++ b/BaseTools/Source/C/Common/Decompress.c
@@ -254,10 +254,11 @@ Returns:
if (Len <= TableBits) {
+ if (Start[Len] >= NextCode || NextCode > MaxTableLength){
+ return (UINT16) BAD_TABLE;
+ }
+
for (Index = Start[Len]; Index < NextCode; Index++) {
- if (Index >= MaxTableLength) {
- return (UINT16) BAD_TABLE;
- }
Table[Index] = Char;
}