In FMMT replace function, when newffs size <= targetffs size, the new free space is calculated wrong as loss the pad data delta size. That will cause invalid binary generated. This patch fixes this issue.
Cc: Rebecca Cran <rebe...@bsdio.com> Cc: Liming Gao <gaolim...@byosoft.com.cn> Cc: Bob Feng <bob.c.f...@intel.com> Signed-off-by: Yuwei Chen <yuwei.c...@intel.com> --- BaseTools/Source/Python/FMMT/core/FvHandler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py b/BaseTools/Source/Python/FMMT/core/FvHandler.py index 49bbc35baa4d..7a6076033681 100644 --- a/BaseTools/Source/Python/FMMT/core/FvHandler.py +++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py @@ -456,7 +456,7 @@ class FvHandler: # Start free space calculating and moving process. self.ModifyTest(TargetFv.Parent, Needed_Space) else: - New_Free_Space = self.TargetFfs.Data.Size - self.NewFfs.Data.Size + New_Free_Space = self.TargetFfs.Data.Size + len(self.TargetFfs.Data.PadData) - self.NewFfs.Data.Size - len(self.NewFfs.Data.PadData) # If TargetFv already have free space, move the new free space into it. if TargetFv.Data.Free_Space: TargetFv.Child[-1].Data.Data += b'\xff' * New_Free_Space -- 2.27.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106493): https://edk2.groups.io/g/devel/message/106493 Mute This Topic: https://groups.io/mt/99845068/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-