From patchwork Tue Jul 12 14:11:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 71852 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp497410qga; Tue, 12 Jul 2016 07:11:21 -0700 (PDT) X-Received: by 10.66.226.201 with SMTP id ru9mr4245962pac.55.1468332681153; Tue, 12 Jul 2016 07:11:21 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id f27si4185924pfd.136.2016.07.12.07.11.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jul 2016 07:11:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8D44F1A1EBD; Tue, 12 Jul 2016 07:12:05 -0700 (PDT) X-Original-To: edk2-devel@ml01.01.org Delivered-To: edk2-devel@ml01.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4B8651A1E9F for ; Tue, 12 Jul 2016 07:12:04 -0700 (PDT) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D9B96C04B33B; Tue, 12 Jul 2016 14:11:18 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-96.phx2.redhat.com [10.3.116.96]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6CEBHtt019862; Tue, 12 Jul 2016 10:11:17 -0400 From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 12 Jul 2016 16:11:13 +0200 Message-Id: <1468332673-29907-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 12 Jul 2016 14:11:18 +0000 (UTC) Subject: [edk2] [URGENT PATCH] BaseTools/GenFds: unbreak Region.PadBuffer X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Liming Gao , Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- 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 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 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()