From nobody Sun May 5 17:21:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+54723+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+54723+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1582348791; cv=none; d=zohomail.com; s=zohoarc; b=KbO9ZY28MWrbKWc4iV6IDJBNVEGMFD037dXKcv2NH3v5byT88+OJljkjSc7YaL3C9lgB/j+BuzUcyRk8du8EszhwXSAc7qQq7y2XRTfBDSppoyOIe7Z8RaGSzUnvHGEBWO/lW8/79jfOwqRTyaItLUz15NA4cRVM3zDy1EzSc4Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582348791; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=pWmT2AqHsHvFF4dTcYfdK6PER7TVEFsY3FlCNdj/o9U=; b=Qb1mqchB88iEJ+Fah5TtAyItpi46SrlTm5Q0xrj+uPsnhoMScx5x3N2dWyRK108KJHt3VuL9Qj49EVxefJNAl/StWjRxCv1Rt2xdfFN2ibYc2fiusVA8CgpwqZiCI/timZwD4UDAEkMrL9ODX/N5I3nJnfthSSQc/285BrAqPtQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+54723+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1582348791609996.3798775315202; Fri, 21 Feb 2020 21:19:51 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id vqlOYY1788612xIUQKwkfnL7; Fri, 21 Feb 2020 21:19:51 -0800 X-Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by mx.groups.io with SMTP id smtpd.web10.3586.1582348790510979427 for ; Fri, 21 Feb 2020 21:19:50 -0800 X-Received: by mail-pj1-f67.google.com with SMTP id e9so1697701pjr.4 for ; Fri, 21 Feb 2020 21:19:50 -0800 (PST) X-Gm-Message-State: qaatpcQz2X96q8OQ9zBYVhPRx1787277AA= X-Google-Smtp-Source: APXvYqxMNCty11abW/FGAe1g1lPjEz7m3puZGiEuuMfJtlfRMqXCKT67+nxRrelycSJei+RLrpx7gg== X-Received: by 2002:a17:902:7d93:: with SMTP id a19mr39680341plm.283.1582348789553; Fri, 21 Feb 2020 21:19:49 -0800 (PST) X-Received: from localhost.localdomain ([223.104.146.86]) by smtp.gmail.com with ESMTPSA id s7sm4069932pgp.44.2020.02.21.21.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 21:19:48 -0800 (PST) From: "GuoMinJ" To: devel@edk2.groups.io Cc: GuoMinJ Subject: [edk2-devel] [PATCH] MdeModulePkg/SmiHandlerProfileInfo: Overflowed Array Index Date: Sat, 22 Feb 2020 13:19:41 +0800 Message-Id: Precedence: Bulk List-Unsubscribe: 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,newexplorerj@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1582348791; bh=/6eBSTfbe9CXnA+W2fzos131QL52BVAgRsj8L+D97vg=; h=Cc:Date:From:Reply-To:Subject:To; b=p2I3KPoFAAbW/JVSZy7aGA+QqxnJCelmp91/WIHD0blBlD+Qss2sGbLVb0W0hxUIFzb dMkCw8zQWDmwGOhMoVR+dWCc9vqdxAksAkcNWCc3fy6X7QA8ogVCu7cgs+EH4PGHnGUUs gbtb2J849kw/t0Jlma5UDAO1MtAsi6X3DSw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2272 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2289 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2290 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2287 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2288 Index should be off-by one than size of array, so when check array, the max index should less than size of array. Signed-off-by: GuoMinJ --- .../SmiHandlerProfileInfo/SmiHandlerProfileInfo.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfi= leInfo.c b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfile= Info.c index 0f7163160b..4f195b16ce 100644 --- a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c +++ b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c @@ -382,7 +382,7 @@ SxTypeToString ( IN EFI_SLEEP_TYPE Type ) { - if (Type >=3D 0 && Type <=3D ARRAY_SIZE(mSxTypeString)) { + if (Type >=3D 0 && Type < ARRAY_SIZE(mSxTypeString)) { return mSxTypeString[Type]; } else { AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type); @@ -407,7 +407,7 @@ SxPhaseToString ( IN EFI_SLEEP_PHASE Phase ) { - if (Phase >=3D 0 && Phase <=3D ARRAY_SIZE(mSxPhaseString)) { + if (Phase >=3D 0 && Phase < ARRAY_SIZE(mSxPhaseString)) { return mSxPhaseString[Phase]; } else { AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase); @@ -457,7 +457,7 @@ StandbyButtonPhaseToString ( IN EFI_STANDBY_BUTTON_PHASE Phase ) { - if (Phase >=3D 0 && Phase <=3D ARRAY_SIZE(mStandbyButtonPhaseString)) { + if (Phase >=3D 0 && Phase < ARRAY_SIZE(mStandbyButtonPhaseString)) { return mStandbyButtonPhaseString[Phase]; } else { AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase); @@ -483,7 +483,7 @@ IoTrapTypeToString ( IN EFI_SMM_IO_TRAP_DISPATCH_TYPE Type ) { - if (Type >=3D 0 && Type <=3D ARRAY_SIZE(mIoTrapTypeString)) { + if (Type >=3D 0 && Type < ARRAY_SIZE(mIoTrapTypeString)) { return mIoTrapTypeString[Type]; } else { AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type); @@ -508,7 +508,7 @@ UsbTypeToString ( IN EFI_USB_SMI_TYPE Type ) { - if (Type >=3D 0 && Type <=3D ARRAY_SIZE(mUsbTypeString)) { + if (Type >=3D 0 && Type < ARRAY_SIZE(mUsbTypeString)) { return mUsbTypeString[Type]; } else { AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type); --=20 2.17.1 -=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 (#54723): https://edk2.groups.io/g/devel/message/54723 Mute This Topic: https://groups.io/mt/71466308/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-