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-14 08:39:48 +0800
commitb633c7357d30c0efc782eefdbc81b739aee5e427 (patch)
treed6d24d011cf086724632f40d78741f70071576c4
parentc924df7ccf6df287035728b65d6f29283b517437 (diff)
downloadedk2-b633c7357d30c0efc782eefdbc81b739aee5e427.tar.gz
edk2-b633c7357d30c0efc782eefdbc81b739aee5e427.tar.bz2
edk2-b633c7357d30c0efc782eefdbc81b739aee5e427.zip
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> (cherry picked from commit 5e45a1fdcfbf9b2b389122eb97475148594625f8)
-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 a87e806961..ed08545918 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 7f169614b4..e6c9fd229f 100644
--- a/BaseTools/Source/C/TianoCompress/TianoCompress.c
+++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c
@@ -2650,6 +2650,12 @@ Returns: (VOID)
BytesRemain--;
}
+ //
+ // Once mOutBuf is fully filled, directly return
+ //
+ if (Sd->mOutBuf >= Sd->mOrigSize) {
+ goto Done ;
+ }
}
}