From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 294BDD8023C for ; Sat, 18 Nov 2023 13:06:15 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=+fthqU0fUM+XsTStXtpigCSvAj4NTiGeD8M5c5bX+DA=; c=relaxed/simple; d=groups.io; h=Message-ID:From:To:References:In-Reply-To:Subject:Date:MIME-Version:Importance:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding:Content-Length; s=20140610; t=1700312774; v=1; b=wtis/xjslivNvVOeRde2jXv4b3Z9ZOGOLLHWhKZ2YHtaq05UG8FXR6pfwTYbquDRDjUMmXeP V0y3h7IRmljWqBSMTDuadkrCm6MCa+6w9HKYHYlYlHr35IyTlUfm9QFUgeeNtMvOVsuuEUVVa9E ebqHkEmEunUKWr7G9oSEa0CI= X-Received: by 127.0.0.2 with SMTP id pES3YY7687511xmXbFOAeS6o; Sat, 18 Nov 2023 05:06:14 -0800 X-Received: from sonic302-24.consmr.mail.ne1.yahoo.com (sonic302-24.consmr.mail.ne1.yahoo.com [66.163.186.150]) by mx.groups.io with SMTP id smtpd.web10.7755.1700312774030954717 for ; Sat, 18 Nov 2023 05:06:14 -0800 X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1700312773; bh=usT9eq2bfHEv7gPW0rbIL0doQN6zje8sPESvqwLO0Kl=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=mP8YU8mdqB1Wngv8yAWjJQsPbkaXB+zkyzsc9tUGFQWkIBpf+ZOKgvM0WbRub2wyug6FX7T4AYyscNNavNgfECTOng8inwMmiMGQTJt7BybzaxC7Tde33KkMzj5xIpQrtsH7dM3VkJADXXWsIsjD8N4fe/Cijn0TW+v9/YAtMlgcZ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psJww7J0 2pzjaDGXejq3cFyw6p41CxHmCRS648n4BXUWsWKYQZ4eSkndtqBd7o8UFyChZwDbi4jEu2UWMG5V wnHGaWQ0SkkpOjJO1RWhAOyM79Y9eLnC8mToRlxw4UX2.r7KEl4zTWSeuJLTqqhfxQ_N7flC2B.L u..4v0w4LzmJhdEefQYsowlGNvWikPwzL93SENYRw9MEWExEeNPgXMtfFoK4ldQ_Tn.Wv0u8hAG9 i5SrB1lJKuOgTnC74ICeoXmdcdkvAniekjt6VblOy.Y.yPqfD4wz4BdkOfK9CdqBtUtmiMU8lEvf vuggA6tly3vZVIvtKYJuq1VeqvyoNzV2Jhshf X-Sonic-MF: X-Sonic-ID: bb36c088-6d06-43c7-b8ee-195b1e828db0 X-Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.ne1.yahoo.com with HTTP; Sat, 18 Nov 2023 13:06:13 +0000 X-Received: by hermes--production-bf1-5b945b6d47-jx96d (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 49b3e7bfca7e172eac16d71219a0d923; Sat, 18 Nov 2023 13:06:07 +0000 (UTC) Message-ID: From: "Charles Hyde" To: , References: <62690423D2A24D1DBB82CD22AE44EADE.ref@DESKTOPQUG2G9K> <62690423D2A24D1DBB82CD22AE44EADE@DESKTOPQUG2G9K> In-Reply-To: Subject: Re: [edk2-devel] [PATCH v1 1/1] Bug 2861 - HiiDatabaseDxe, ConfigRouting.c, GetElementsFromRequest incorrect error handling. Date: Sat, 18 Nov 2023 08:06:01 -0500 MIME-Version: 1.0 X-Priority: 3 Importance: Normal Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chip.programmer@att.net List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: M6FrZNOXidyDNRwnR5sGJ4Tnx7686176AA= Content-Type: text/plain; format=flowed; charset="UTF-8"; reply-type=original Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=fail ("headers rsa verify failed") header.d=groups.io header.s=20140610 header.b="wtis/xjs"; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=none How many different patches are you looking for? One patch to fix bug 2861 specifically, and a separate patch that fixes the= =20 uninitialized pointer issue? I provided the second previously (June and=20 July 2023), and literally nobody commented in edk2-rfc or edk2-devel. Chip -----Original Message-----=20 From: Laszlo Ersek Sent: Monday, November 13, 2023 9:59 AM To: devel@edk2.groups.io ; chip.programmer@att.net Subject: Re: [edk2-devel] [PATCH v1 1/1] Bug 2861 - HiiDatabaseDxe,=20 ConfigRouting.c, GetElementsFromRequest incorrect error handling. Hi Charles, On 10/26/23 03:05, Charles Hyde wrote: > From: Charles Hyde > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2861 > > I believe the attached ConfigRouting.txt patch will resolve bug 2861, plu= s > resolve an uninitialized pointer issue in HiiConfigRoutingExportConfig(). > The uninitialized pointer was identified when running the EDK2 Self > Certification Test with all tests selected, having caused the CPU to issu= e > an exception error (most times) or completely trashed the system > (sometimes). > > I found a second instance of GetElementsFromRequest(), located in=20 > HiiLib.c, > that also needed an update. The attached patch should address this bug= =20 > and > more. > > Signed-off-by: Charles Hyde > --- Thanks for analyzing and fixing these bugs. Can you please split the separate fixes to separate patches? Also, the patch looks garbled; it shouldn't be attached / pasted but sent with git-send-email. Are you familiar with git-send-email? Here's the official docs: https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Development-Pr= ocess and some unofficial tips: https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-= guide-for-edk2-contributors-and-maintainers Third, I suggest not to comment out, with /* */, dead code (such as a subcondition that always evaluates to false or true); instead, remove it, and explain in the commit message (or, if necessary, in a code comment) why that condition is a tautology. If the condition or argument is nontrivial, consider using an ASSERT(). Laszlo > > diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c > b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c > index 63a37ab59a..c3dc7bf558 100644 > --- a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c > +++ b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c > @@ -2272,8 +2272,14 @@ GetElementsFromRequest ( > { > EFI_STRING TmpRequest; > > + ASSERT (ConfigRequest !=3D NULL); > + if (ConfigRequest =3D=3D NULL) > + return FALSE; > + > TmpRequest =3D StrStr (ConfigRequest, L"PATH=3D"); > ASSERT (TmpRequest !=3D NULL); > + if (TmpRequest =3D=3D NULL) > + return FALSE; > > if ((StrStr (TmpRequest, L"&OFFSET=3D") !=3D NULL) || (StrStr (TmpReque= st, > L"&") !=3D NULL)) { > return TRUE; > diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > index 5ae6189a28..0b39f156f3 100644 > --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > @@ -420,14 +420,19 @@ AppendToMultiString ( > } > > AppendStringSize =3D StrSize (AppendString); > + if (AppendStringSize <=3D sizeof(*AppendString)) // If the string i= s > empty, there is no need to proceed further. > + return EFI_SUCCESS; > + > MultiStringSize =3D StrSize (*MultiString); > MaxLen =3D MAX_STRING_LENGTH / sizeof (CHAR16); > > // > // Enlarge the buffer each time when length exceeds MAX_STRING_LENGTH. > // > - if ((MultiStringSize + AppendStringSize > MAX_STRING_LENGTH) || > - (MultiStringSize > MAX_STRING_LENGTH)) > + if ((MultiStringSize + AppendStringSize > MAX_STRING_LENGTH) /*|| > + (MultiStringSize > MAX_STRING_LENGTH)*/) // There is no need to > check the second part. > + // If the first part is > false, the second part will always be false. > + // If the second part is > true, the first part must also be true. > { > *MultiString =3D (EFI_STRING)ReallocatePool ( > MultiStringSize, > @@ -1800,8 +1805,14 @@ GetElementsFromRequest ( > { > EFI_STRING TmpRequest; > > + ASSERT (ConfigRequest !=3D NULL); > + if (ConfigRequest =3D=3D NULL) > + return FALSE; > + > TmpRequest =3D StrStr (ConfigRequest, L"PATH=3D"); > ASSERT (TmpRequest !=3D NULL); > + if (TmpRequest =3D=3D NULL) > + return FALSE; > > if ((StrStr (TmpRequest, L"&OFFSET=3D") !=3D NULL) || (StrStr (TmpReque= st, > L"&") !=3D NULL)) { > return TRUE; > @@ -5292,6 +5303,7 @@ HiiConfigRoutingExportConfig ( > // > IfrDataParsedFlag =3D FALSE; > Progress =3D NULL; > + AccessResults =3D NULL; > HiiHandle =3D NULL; > DefaultResults =3D NULL; > Database =3D NULL; > @@ -5326,6 +5338,14 @@ HiiConfigRoutingExportConfig ( > &AccessResults > ); > if (EFI_ERROR (Status)) { > + > + // If an error was returned, then do not believe any results in > these > two pointers. > + Progress =3D NULL; > + if (AccessResults) { > + FreePool (AccessResults); > + AccessResults =3D NULL; > + } > + > // > // Update AccessResults by getting default setting from IFR when > HiiPackage is registered to HiiHandle > // > @@ -5350,6 +5370,17 @@ HiiConfigRoutingExportConfig ( > } > > if (!EFI_ERROR (Status)) { > + > + // If AccessResults =3D=3D NULL, there is nothing to be done. > + if (AccessResults =3D=3D NULL) { > + Progress =3D NULL; > + > + if (ConfigRequest !=3D NULL) > + FreePool (ConfigRequest); > + > + continue; > + } > + > // > // Update AccessResults by getting default setting from IFR when > HiiPackage is registered to HiiHandle > // > > > > > -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111425): https://edk2.groups.io/g/devel/message/111425 Mute This Topic: https://groups.io/mt/102191640/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-