From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=jian.j.wang@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 AB5842034B436 for ; Wed, 27 Dec 2017 18:00:23 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Dec 2017 18:05:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,468,1508828400"; d="scan'208";a="162224717" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga004.jf.intel.com with ESMTP; 27 Dec 2017 18:05:19 -0800 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 27 Dec 2017 18:05:18 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 27 Dec 2017 18:05:18 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Thu, 28 Dec 2017 10:05:16 +0800 From: "Wang, Jian J" To: "Gao, Liming" , "Kinney, Michael D" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" , "Zeng, Star" Thread-Topic: [edk2] [PATCH] MdePkg/BasePrintLib: Fix incorrect Precision position calculation Thread-Index: AQHTfSVj1FRHdxIRVUizEXTJjKZQf6NWdgFQgABrqQCAAQlioP//ksmAgACHx7A= Date: Thu, 28 Dec 2017 02:05:16 +0000 Message-ID: References: <20171225020847.14076-1-jian.j.wang@intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E199A4E@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E199A4E@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzc0YTUxYzEtODdlMS00OWVkLWE0ZmItYjlmNjE3OGJkYjk1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJDOWJkdmcreGFvZXNsTUhNRHFJMGZldDgyVXRORlFcLzZ5bHFGYytkaXJEVzJCekxBRFVBMGpXTnVpUGFGZjBnQSJ9 x-ctpclassification: CTP_NT x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdePkg/BasePrintLib: Fix incorrect Precision position calculation 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: , X-List-Received-Date: Thu, 28 Dec 2017 02:00:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Sure. Regards, Jian > -----Original Message----- > From: Gao, Liming > Sent: Thursday, December 28, 2017 9:57 AM > To: Wang, Jian J ; Kinney, Michael D > ; edk2-devel@lists.01.org > Cc: Yao, Jiewen ; Zeng, Star > Subject: RE: [edk2] [PATCH] MdePkg/BasePrintLib: Fix incorrect Precision > position calculation >=20 > Jian: > MdePkg/Library/BasePrintLib/PrintLibInternal.c line 1171 has the simila= r issue. > Could you fix it also? >=20 > And, MdeModulePkg\Library\DxePrintLibPrint2Protocol\PrintLib.c have the > same issue. Could you sync this fix to it? >=20 > Thanks > Liming > > -----Original Message----- > > From: Wang, Jian J > > Sent: Thursday, December 28, 2017 8:29 AM > > To: Kinney, Michael D ; edk2-devel@lists.01= .org > > Cc: Yao, Jiewen ; Zeng, Star ; > Gao, Liming > > Subject: RE: [edk2] [PATCH] MdePkg/BasePrintLib: Fix incorrect Precisio= n > position calculation > > > > I revisit the code again. You're right that the commit log is not corre= ct. > > The '\0' would be read and even the one pass it. > > > > Regards, > > Jian > > > > > > > -----Original Message----- > > > From: Kinney, Michael D > > > Sent: Thursday, December 28, 2017 12:38 AM > > > To: Wang, Jian J ; edk2-devel@lists.01.org; Ki= nney, > > > Michael D > > > Cc: Yao, Jiewen ; Zeng, Star ; > > > Gao, Liming > > > Subject: RE: [edk2] [PATCH] MdePkg/BasePrintLib: Fix incorrect Precis= ion > > > position calculation > > > > > > Is the commit log correct? > > > > > > Is the issue that the character past the '\0' could be read? > > > > > > Mike > > > > > > > -----Original Message----- > > > > From: Wang, Jian J > > > > Sent: Tuesday, December 26, 2017 6:14 PM > > > > To: Wang, Jian J ; edk2- > > > > devel@lists.01.org > > > > Cc: Kinney, Michael D ; Yao, > > > > Jiewen ; Zeng, Star > > > > ; Gao, Liming > > > > Subject: RE: [edk2] [PATCH] MdePkg/BasePrintLib: Fix > > > > incorrect Precision position calculation > > > > > > > > Mike and Liming, > > > > > > > > Could you take a look at this patch? > > > > > > > > Regards, > > > > Jian > > > > > > > > > > > > > -----Original Message----- > > > > > From: edk2-devel [mailto:edk2-devel- > > > > bounces@lists.01.org] On Behalf Of Jian J > > > > > Wang > > > > > Sent: Monday, December 25, 2017 10:09 AM > > > > > To: edk2-devel@lists.01.org > > > > > Cc: Kinney, Michael D ; > > > > Yao, Jiewen > > > > > ; Zeng, Star > > > > ; Gao, Liming > > > > > > > > > > Subject: [edk2] [PATCH] MdePkg/BasePrintLib: Fix > > > > incorrect Precision position > > > > > calculation > > > > > > > > > > Due to the a potential hole in the stop condition of > > > > for-loop, the two > > > > > continuous access to ArgumentString (index, index+1) > > > > inside the loop > > > > > might cause the string ending character ('\0') to be > > > > read. > > > > > > > > > > Cc: Michael D Kinney > > > > > Cc: Liming Gao > > > > > Cc: Jiewen Yao > > > > > Cc: Star Zeng > > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > > > > Signed-off-by: Jian J Wang > > > > > --- > > > > > MdePkg/Library/BasePrintLib/PrintLibInternal.c | 5 > > > > ++++- > > > > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > > > > > > > diff --git > > > > a/MdePkg/Library/BasePrintLib/PrintLibInternal.c > > > > > b/MdePkg/Library/BasePrintLib/PrintLibInternal.c > > > > > index 28d946472f..297d5a05b5 100644 > > > > > --- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c > > > > > +++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c > > > > > @@ -1107,7 +1107,10 @@ BasePrintLibSPrintMarker ( > > > > > // Compute the number of characters in > > > > ArgumentString and store it in > > > > > Count > > > > > // ArgumentString is either null-terminated, or > > > > it contains Precision > > > > > characters > > > > > // > > > > > - for (Count =3D 0; Count < Precision || ((Flags & > > > > PRECISION) =3D=3D 0); Count++) { > > > > > + for (Count =3D 0; > > > > > + ArgumentString[Count * > > > > BytesPerArgumentCharacter] !=3D '\0' && > > > > > + (Count < Precision || ((Flags & PRECISION) > > > > =3D=3D 0)); > > > > > + Count++) { > > > > > ArgumentCharacter =3D ((ArgumentString[Count * > > > > > BytesPerArgumentCharacter] & 0xff) | > > > > ((ArgumentString[Count * > > > > > BytesPerArgumentCharacter + 1]) << 8)) & ArgumentMask; > > > > > if (ArgumentCharacter =3D=3D 0) { > > > > > break; > > > > > -- > > > > > 2.15.1.windows.2 > > > > > > > > > > _______________________________________________ > > > > > edk2-devel mailing list > > > > > edk2-devel@lists.01.org > > > > > https://lists.01.org/mailman/listinfo/edk2-devel