summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiming Gao <liming.gao@intel.com>2018-11-09 07:58:14 +0800
committerLiming Gao <liming.gao@intel.com>2018-11-11 11:48:31 +0800
commit5e45a1fdcfbf9b2b389122eb97475148594625f8 (patch)
tree8d15b82e203b1f7a88185e1299ffe05a360df4ee
parent114a75ad8694046372d4892d0d5e59b4088b2885 (diff)
downloadedk2-5e45a1fdcfbf9b2b389122eb97475148594625f8.tar.gz
BaseTools: Fix UEFI and Tiano Decompression logic issue
https://bugzilla.tianocore.org/show_bug.cgi?id=1317 This is a regression issue caused by 041d89bc0f0119df37a5fce1d0f16495ff905089. In Decode() function, once mOutBuf is fully filled, Decode() should return. Current logic misses the checker of mOutBuf after while() loop. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
-rw-r--r--BaseTools/Source/C/Common/Decompress.c6
-rw-r--r--BaseTools/Source/C/TianoCompress/TianoCompress.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/BaseTools/Source/C/Common/Decompress.c b/BaseTools/Source/C/Common/Decompress.c
index 71313b1179..33e0f0d160 100644
--- a/BaseTools/Source/C/Common/Decompress.c
+++ b/BaseTools/Source/C/Common/Decompress.c
@@ -662,6 +662,12 @@ Returns: (VOID)
BytesRemain--;
}
+ //
+ // Once mOutBuf is fully filled, directly return
+ //
+ if (Sd->mOutBuf >= Sd->mOrigSize) {
+ return ;
+ }
}
}
diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c b/BaseTools/Source/C/TianoCompress/TianoCompress.c
index 2d6fc4c952..a77f6798ec 100644
--- a/BaseTools/Source/C/TianoCompress/TianoCompress.c
+++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c
@@ -2682,6 +2682,12 @@ Returns: (VOID)
BytesRemain--;
}
+ //
+ // Once mOutBuf is fully filled, directly return
+ //
+ if (Sd->mOutBuf >= Sd->mOrigSize) {
+ goto Done ;
+ }
}
}