From: Laszlo Ersek Date: Tue, 12 Jul 2016 13:52:38 +0000 (+0200) Subject: BaseTools/GenFds: unbreak Region.PadBuffer X-Git-Tag: edk2-stable201903~6335 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=a78b518b6eddef545fa440822bec315b31e4e987;p=mirror_edk2.git BaseTools/GenFds: unbreak Region.PadBuffer In its current form, Region.PadBuffer() fills every second byte with 0x20, the default separator string of Python's string.join(): https://docs.python.org/2/library/string.html#string.join This corrupts some firmware because (a) 0x20 never corresponds to any ErasePolarity, (b) the PadData produced are actually longer than Size. Cc: Ard Biesheuvel Cc: Liming Gao Cc: Yonghong Zhu Reported-by: Ard Biesheuvel Fixes: bd907fb6386560e621112beca7b7d381d0003967 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Tested-by: Ard Biesheuvel Reviewed-by: Ard Biesheuvel --- diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Python/GenFds/Region.py index 7548a4f014..e393286a16 100644 --- a/BaseTools/Source/Python/GenFds/Region.py +++ b/BaseTools/Source/Python/GenFds/Region.py @@ -56,7 +56,7 @@ class Region(RegionClassObject): PadByte = pack('B', 0xFF) else: PadByte = pack('B', 0) - PadData = string.join(PadByte for i in xrange(0, Size)) + PadData = ''.join(PadByte for i in xrange(0, Size)) Buffer.write(PadData) ## AddToBuffer()