Message ID | 1468332673-29907-1-git-send-email-lersek@redhat.com |
---|---|
State | Accepted |
Commit | a78b518b6eddef545fa440822bec315b31e4e987 |
Headers | show |
On 12 July 2016 at 16:11, Laszlo Ersek <lersek@redhat.com> wrote: > 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> > --- > > Notes: > Apparently Laszlo is not a Python programmer. > > BaseTools/Source/Python/GenFds/Region.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Python/GenFds/Region.py > index 7548a4f014b1..e393286a1637 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() > -- > 1.8.3.1 > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
On 07/12/16 16:12, Ard Biesheuvel wrote: > On 12 July 2016 at 16:11, Laszlo Ersek <lersek@redhat.com> wrote: >> 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> Thanks Ard. Commit a78b518b6edd. Laszlo >> --- >> >> Notes: >> Apparently Laszlo is not a Python programmer. >> >> BaseTools/Source/Python/GenFds/Region.py | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Python/GenFds/Region.py >> index 7548a4f014b1..e393286a1637 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() >> -- >> 1.8.3.1 >> > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Python/GenFds/Region.py index 7548a4f014b1..e393286a1637 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()
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> --- Notes: Apparently Laszlo is not a Python programmer. BaseTools/Source/Python/GenFds/Region.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.8.3.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel