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=jaben.carsey@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 8022B21184ABC for ; Wed, 31 Oct 2018 09:15:40 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Oct 2018 09:15:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,447,1534834800"; d="scan'208";a="270337885" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga005.jf.intel.com with ESMTP; 31 Oct 2018 09:15:39 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 31 Oct 2018 09:15:39 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.186]) by fmsmsx101.amr.corp.intel.com ([169.254.1.202]) with mapi id 14.03.0415.000; Wed, 31 Oct 2018 09:15:38 -0700 From: "Carsey, Jaben" To: "Zhao, ZhiqiangX" , "edk2-devel@lists.01.org" CC: "Gao, Liming" Thread-Topic: [edk2] [PATCH] BaseTools: Check the max size for string PCD. Thread-Index: AQHUcQWT7HdiandcNE2p6uol7Pu2faU5h91Q Date: Wed, 31 Oct 2018 16:15:38 +0000 Message-ID: References: <20181031103547.140588-1-zhiqiangx.zhao@intel.com> In-Reply-To: <20181031103547.140588-1-zhiqiangx.zhao@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTRkMTMwNGUtY2U4Zi00MTk4LTgxNzAtZDYyYzk2NTdmMGRkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoidVwvQ3BKRjFoXC9xTHRxUzFMRGZJbHVYdUdyUlBPUFB5XC83dU50RE12SkI0c1gwTjExUldFMUdDMWZmeDk5QWROZiJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.1.200.106] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTools: Check the max size for string PCD. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 16:15:40 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Zhaozh1x > Sent: Wednesday, October 31, 2018 3:36 AM > To: edk2-devel@lists.01.org > Cc: Gao, Liming > Subject: [edk2] [PATCH] BaseTools: Check the max size for string PCD. >=20 > According to PCD_DATABASE_INIT in > edk2\MdeModulePkg\Include\Guid\PcdDataBaseSignatureGuid.h, > the max size for string PCD should not exceed USHRT_MAX 65535(0xffff). >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: ZhiqiangX Zhao > Cc: Liming Gao > Cc: Yonghong Zhu > Cc: Bob Feng > --- > BaseTools/Source/Python/AutoGen/AutoGen.py | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py > b/BaseTools/Source/Python/AutoGen/AutoGen.py > index 9c3759c0f5..33f7e6471d 100644 > --- a/BaseTools/Source/Python/AutoGen/AutoGen.py > +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py > @@ -1397,6 +1397,13 @@ class PlatformAutoGen(AutoGen): > self.VariableInfo =3D self.CollectVariables(self._Dynami= cPcdList) > vardump =3D self.VariableInfo.dump() > if vardump: > + # > + #According to PCD_DATABASE_INIT in > edk2\MdeModulePkg\Include\Guid\PcdDataBaseSignatureGuid.h, > + #the max size for string PCD should not exceed USHRT= _MAX > 65535(0xffff). > + #typedef UINT16 SIZE_INFO; > + #//SIZE_INFO SizeTable[]; > + if len(vardump.split(",")) > 0xffff: > + EdkLogger.error("build", RESOURCE_OVERFLOW, 'The= current > length of PCD %s value is %d, it exceeds to the max size of String PCD.' > %(".".join([PcdNvStoreDfBuffer.TokenSpaceGuidCName,PcdNvStoreDfBuffe > r.TokenCName]) ,len(vardump.split(",")))) > PcdNvStoreDfBuffer.DefaultValue =3D vardump > for skuname in PcdNvStoreDfBuffer.SkuInfoList: > PcdNvStoreDfBuffer.SkuInfoList[skuname].DefaultV= alue =3D > vardump > -- > 2.14.1.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel