]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/GenFds: unbreak Region.PadBuffer
authorLaszlo Ersek <lersek@redhat.com>
Tue, 12 Jul 2016 13:52:38 +0000 (15:52 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Tue, 12 Jul 2016 14:22:28 +0000 (16:22 +0200)
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 <ard.biesheuvel@linaro.org>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Fixes: bd907fb6386560e621112beca7b7d381d0003967
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
BaseTools/Source/Python/GenFds/Region.py

index 7548a4f014b1397be4bb6cfbb3b7b287119d06fc..e393286a1637e07e9b96cbed2a5c268170c32323 100644 (file)
@@ -56,7 +56,7 @@ class Region(RegionClassObject):
                 PadByte = pack('B', 0xFF)\r
             else:\r
                 PadByte = pack('B', 0)\r
-            PadData = string.join(PadByte for i in xrange(0, Size))\r
+            PadData = ''.join(PadByte for i in xrange(0, Size))\r
             Buffer.write(PadData)\r
 \r
     ## AddToBuffer()\r