From 66566e28b57446f1ae08afa0d72d695af8401d79 Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Fri, 9 Nov 2018 07:58:15 +0800 Subject: MdePkg BaseUefiDecompressLib: Fix UEFI Decompression logic issue https://bugzilla.tianocore.org/show_bug.cgi?id=1317 This is a regression issue caused by 2ec7953d49677142c5f7552e9e3d96fb406ba0c4. 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 Cc: Michael Kinney Reviewed-by: Yonghong Zhu (cherry picked from commit 1c4cecc9fd314de0dce8125b0d4b45967637a401) --- MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c index 0c6b1fe4ee..8c30e971f9 100644 --- a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c +++ b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c @@ -641,6 +641,12 @@ Decode ( BytesRemain--; } + // + // Once mOutBuf is fully filled, directly return + // + if (Sd->mOutBuf >= Sd->mOrigSize) { + goto Done; + } } } -- cgit v1.2.3