|
|
bdb79c |
From 461390a9ced1986f752b2e64f36f3deee982eb6d Mon Sep 17 00:00:00 2001
|
|
|
bdb79c |
From: Philippe Mathieu-Daude <philmd@redhat.com>
|
|
|
bdb79c |
Date: Wed, 13 Feb 2019 09:50:48 +0100
|
|
|
bdb79c |
Subject: [PATCH 05/13] BaseTools: Fix UEFI and Tiano Decompression logic issue
|
|
|
bdb79c |
MIME-Version: 1.0
|
|
|
bdb79c |
Content-Type: text/plain; charset=UTF-8
|
|
|
bdb79c |
Content-Transfer-Encoding: 8bit
|
|
|
bdb79c |
|
|
|
bdb79c |
Message-id: <20190213085050.20766-6-philmd@redhat.com>
|
|
|
bdb79c |
Patchwork-id: 84484
|
|
|
bdb79c |
O-Subject: [RHEL-7.7 ovmf PATCH v3 5/7] BaseTools: Fix UEFI and Tiano
|
|
|
bdb79c |
Decompression logic issue
|
|
|
bdb79c |
Bugzilla: 1666586
|
|
|
bdb79c |
Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
bdb79c |
Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
bdb79c |
|
|
|
bdb79c |
From: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
bdb79c |
|
|
|
bdb79c |
From: Liming Gao <liming.gao@intel.com>
|
|
|
bdb79c |
|
|
|
bdb79c |
--v-- RHEL7 note start --v--
|
|
|
bdb79c |
|
|
|
bdb79c |
While reviewing the RHEL8 original of this backport, Laszlo had to look
|
|
|
bdb79c |
at the "BaseTools/Source/C/TianoCompress/TianoCompress.c" hunk for a
|
|
|
bdb79c |
while longer, due to commit 472eb3b89682 missing down-stream, which he
|
|
|
bdb79c |
remembered from downstream commit 29c394f110b1.
|
|
|
bdb79c |
|
|
|
bdb79c |
However, this hunk affects the Decode() function, which is not affected
|
|
|
bdb79c |
by the upstream-only "UefiCompress method", and also not affected by the
|
|
|
bdb79c |
related upstream-only Decompress()->TDecompress() rename. Decode() --
|
|
|
bdb79c |
i.e. the function being patched -- is called from Decompress() /
|
|
|
bdb79c |
TDecompress().
|
|
|
bdb79c |
|
|
|
bdb79c |
Therefore, the "git backport-diff" report in the blurb which marks this
|
|
|
bdb79c |
backport patch "identical", is credible.
|
|
|
bdb79c |
|
|
|
bdb79c |
--^-- RHEL7 note end --^--
|
|
|
bdb79c |
|
|
|
bdb79c |
https://bugzilla.tianocore.org/show_bug.cgi?id=1317
|
|
|
bdb79c |
|
|
|
bdb79c |
This is a regression issue caused by 041d89bc0f0119df37a5fce1d0f16495ff905089.
|
|
|
bdb79c |
In Decode() function, once mOutBuf is fully filled, Decode() should return.
|
|
|
bdb79c |
Current logic misses the checker of mOutBuf after while() loop.
|
|
|
bdb79c |
|
|
|
bdb79c |
Contributed-under: TianoCore Contribution Agreement 1.1
|
|
|
bdb79c |
Signed-off-by: Liming Gao <liming.gao@intel.com>
|
|
|
bdb79c |
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
|
|
|
bdb79c |
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
|
|
|
bdb79c |
(cherry picked from commit 5e45a1fdcfbf9b2b389122eb97475148594625f8)
|
|
|
bdb79c |
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
bdb79c |
(cherry picked from commit 115cf260ac54a6793a184227d6ae6bfe3da74a56)
|
|
|
bdb79c |
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
|
|
|
bdb79c |
---
|
|
|
bdb79c |
BaseTools/Source/C/Common/Decompress.c | 6 ++++++
|
|
|
bdb79c |
BaseTools/Source/C/TianoCompress/TianoCompress.c | 6 ++++++
|
|
|
bdb79c |
2 files changed, 12 insertions(+)
|
|
|
bdb79c |
|
|
|
bdb79c |
diff --git a/BaseTools/Source/C/Common/Decompress.c b/BaseTools/Source/C/Common/Decompress.c
|
|
|
bdb79c |
index bdc10f5..af76f67 100644
|
|
|
bdb79c |
--- a/BaseTools/Source/C/Common/Decompress.c
|
|
|
bdb79c |
+++ b/BaseTools/Source/C/Common/Decompress.c
|
|
|
bdb79c |
@@ -662,6 +662,12 @@ Returns: (VOID)
|
|
|
bdb79c |
|
|
|
bdb79c |
BytesRemain--;
|
|
|
bdb79c |
}
|
|
|
bdb79c |
+ //
|
|
|
bdb79c |
+ // Once mOutBuf is fully filled, directly return
|
|
|
bdb79c |
+ //
|
|
|
bdb79c |
+ if (Sd->mOutBuf >= Sd->mOrigSize) {
|
|
|
bdb79c |
+ return ;
|
|
|
bdb79c |
+ }
|
|
|
bdb79c |
}
|
|
|
bdb79c |
}
|
|
|
bdb79c |
|
|
|
bdb79c |
diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c b/BaseTools/Source/C/TianoCompress/TianoCompress.c
|
|
|
bdb79c |
index d07fd9e..369f7b3 100644
|
|
|
bdb79c |
--- a/BaseTools/Source/C/TianoCompress/TianoCompress.c
|
|
|
bdb79c |
+++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c
|
|
|
bdb79c |
@@ -2649,6 +2649,12 @@ Returns: (VOID)
|
|
|
bdb79c |
|
|
|
bdb79c |
BytesRemain--;
|
|
|
bdb79c |
}
|
|
|
bdb79c |
+ //
|
|
|
bdb79c |
+ // Once mOutBuf is fully filled, directly return
|
|
|
bdb79c |
+ //
|
|
|
bdb79c |
+ if (Sd->mOutBuf >= Sd->mOrigSize) {
|
|
|
bdb79c |
+ goto Done ;
|
|
|
bdb79c |
+ }
|
|
|
bdb79c |
}
|
|
|
bdb79c |
}
|
|
|
bdb79c |
|
|
|
bdb79c |
--
|
|
|
bdb79c |
1.8.3.1
|
|
|
bdb79c |
|