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 <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: bd907fb638
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>
This commit is contained in:
Laszlo Ersek 2016-07-12 15:52:38 +02:00
parent e191a3114f
commit a78b518b6e
1 changed files with 1 additions and 1 deletions

View File

@ -56,7 +56,7 @@ class Region(RegionClassObject):
PadByte = pack('B', 0xFF) PadByte = pack('B', 0xFF)
else: else:
PadByte = pack('B', 0) 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) Buffer.write(PadData)
## AddToBuffer() ## AddToBuffer()