From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 F334C210BFF68 for ; Wed, 25 Jul 2018 17:41:34 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2018 17:41:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,403,1526367600"; d="scan'208";a="59516097" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga007.jf.intel.com with ESMTP; 25 Jul 2018 17:41:19 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 25 Jul 2018 17:41:16 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.100]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.57]) with mapi id 14.03.0319.002; Thu, 26 Jul 2018 08:41:14 +0800 From: "Zhu, Yonghong" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [edk2] [PATCH] BaseTools: Parse decimal format INF_VERSION incorrect Thread-Index: AQHUI8lQvB3Iiwa+MkSCgpMnySLdH6Sgqx/g Date: Thu, 26 Jul 2018 00:41:14 +0000 Message-ID: References: <1532490041-516-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1532490041-516-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTools: Parse decimal format INF_VERSION incorrect X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jul 2018 00:41:35 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yong= hong Zhu Sent: Wednesday, July 25, 2018 11:41 AM To: edk2-devel@lists.01.org Cc: Gao, Liming Subject: [edk2] [PATCH] BaseTools: Parse decimal format INF_VERSION incorre= ct From: Yunhua Feng hex number 0x00010019, the major number is 0001, the minor number is 0019. the decimal number 1.25, the major number is 1, and the minor number is 25 Fix https://bugzilla.tianocore.org/show_bug.cgi?id=3D921 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/Workspace/MetaFileParser.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTool= s/Source/Python/Workspace/MetaFileParser.py index fbfc182c8b..250cbf79a9 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -374,13 +374,16 @@ class MetaFileParser(object): if Name =3D=3D 'INF_VERSION': if hexVersionPattern.match(Value): self._Version =3D int(Value, 0) elif decVersionPattern.match(Value): ValueList =3D Value.split('.') - Major =3D '%04o' % int(ValueList[0], 0) - Minor =3D '%04o' % int(ValueList[1], 0) - self._Version =3D int('0x' + Major + Minor, 0) + Major =3D int(ValueList[0], 0) + Minor =3D int(ValueList[1], 0) + if Major > 0xffff or Minor > 0xffff: + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid ver= sion number", + ExtraData=3Dself._CurrentLine, File=3D= self.MetaFile, Line=3Dself._LineIndex + 1) + self._Version =3D int('0x' +=20 + '{0:04x}{1:04x}'.format(Major, Minor), 0) else: EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version= number", ExtraData=3Dself._CurrentLine, File=3Dself= .MetaFile, Line=3Dself._LineIndex + 1) =20 if isinstance(self, InfParser) and self._Version < 0x00010005: -- 2.12.2.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel