From nobody Fri May 3 08:13:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1517802158545903.9035888689185; Sun, 4 Feb 2018 19:42:38 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E1A72223AF837; Sun, 4 Feb 2018 19:36:55 -0800 (PST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 3527E22364880 for ; Sun, 4 Feb 2018 19:36:55 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Feb 2018 19:42:36 -0800 Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga004.fm.intel.com with ESMTP; 04 Feb 2018 19:42:36 -0800 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 4 Feb 2018 19:42:35 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 4 Feb 2018 19:42:35 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.124]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.125]) with mapi id 14.03.0319.002; Mon, 5 Feb 2018 11:42:33 +0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=yunhuax.feng@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,462,1511856000"; d="dat'59?scan'59,208,59";a="27285438" From: "Feng, YunhuaX" To: "edk2-devel@lists.01.org" Thread-Topic: [PATCH] BaseTools: Report error GUID format if incorrectly Thread-Index: AdOeM1KcDipz8oAVSGGLhyEHG1bHJw== Date: Mon, 5 Feb 2018 03:42:33 +0000 Message-ID: <47C64442C08CCD4089DC43B6B5E46BC482962B@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: <47C64442C08CCD4089DC43B6B5E46BC482962B@shsmsx102.ccr.corp.intel.com> x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: [edk2] [PATCH] BaseTools: Report error GUID format if incorrectly X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Gao, Liming" Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Flexible GUID format support like these: 1. { GUID("11E13869-1896-4A07-8B21-D8B23DD2A2B4") } 2. { GUID({ 0x11e13869, 0x1896, 0x4a07,{ 0x8b, 0x21, 0xd8, 0xb2, 0x3d, 0xd2, 0xa2, 0xb4 } }) } 3. { GUID(gEfiBlockIoProtocolGuid) } Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Common/Misc.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index b8c2ce1ddc..5a0bcd9bf7 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1535,16 +1535,10 @@ def ParseFieldValue (Value): if Value.startswith('GUID') and Value.endswith(')'): Value =3D Value.split('(', 1)[1][:-1].strip() if Value[0] =3D=3D '{' and Value[-1] =3D=3D '}': - Value =3D Value[1:-1].strip() - Value =3D Value.split('{', 1) - Value =3D ['%02x' % int(Item, 16) for Item in (Value[0] + Valu= e[1][:-1]).split(',')] - if len(Value[0]) !=3D 8: - Value[0] =3D '%08X' % int(Value[0], 16) - if len(Value[1]) !=3D 4: - Value[1] =3D '%04X' % int(Value[1], 16) - if len(Value[2]) !=3D 4: - Value[2] =3D '%04X' % int(Value[2], 16) - Value =3D '-'.join(Value[0:3]) + '-' + ''.join(Value[3:5]) + '= -' + ''.join(Value[5:11]) + TmpValue =3D GuidStructureStringToGuidString(Value) + if len(TmpValue) =3D=3D 0: + raise BadExpression("Invalid GUID value string %s" % Value) + Value =3D TmpValue if Value[0] =3D=3D '"' and Value[-1] =3D=3D '"': Value =3D Value[1:-1] try: --=20 2.12.2.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel