From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web11.51.1601573126124852463 for ; Thu, 01 Oct 2020 10:25:26 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=SZjDlbZk; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: chasel.chiu@intel.com) IronPort-SDR: zrdu6e6GRLXl6E6QDLuroxrl3gLD+mLQj6eEj6jF5ZKDGFlWJAkXl5681Tk2tGoXWLx3NC00Id NpUm0c4wV9OQ== X-IronPort-AV: E=McAfee;i="6000,8403,9761"; a="160122578" X-IronPort-AV: E=Sophos;i="5.77,324,1596524400"; d="scan'208";a="160122578" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2020 10:25:24 -0700 IronPort-SDR: bVIub8QJAQqDafzvXDMENsXwRNf/dz8nN7bz1ar6yWSWKcQlA4RwsBQTeOSR/vBL0kn6nNbcpX jEGOXxDYsJvA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,324,1596524400"; d="scan'208";a="416155977" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by fmsmga001.fm.intel.com with ESMTP; 01 Oct 2020 10:25:24 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 1 Oct 2020 10:25:23 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 1 Oct 2020 10:25:23 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.58) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Thu, 1 Oct 2020 10:25:12 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fUFBzsg1kop5V/UUjGlZxtALU4tjdIkzyvrc5RdSM26eEGDOY6QTgTwMcSdYEwWG5QjIt/XcsHfY4wgWd8I9fKbh0zxXedRO2K9rVLtS7XrkGQ4hQu1GQIBzScnt0dV2mQZFDSbd3hnTH9eF9dulxXdMBR7IZROa+E1SxxqztByR8Qf+ZacdqsCrev2Sxlt+U8LRckXWedm3CO8AqZBTOPO9IgRZpgo7p8+y1An8ptwuWxRmGrrCfrJDScYeAiIwdTG76opUviUpMm2bIdiXUaiguIosfjPvRkQbGtRMRAOy8hA4Ws6wQzCH8fSd7qCQ+O1wFS1vI5I2L2thhleHRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9AxvuiLTidJZLzsL7XPg+ZQu/s8vQBGlBV+NSSgHRNg=; b=Ip6yKiuyQvwdSO7g7fKprz45BlAe67Wc1eWbI4aDfklcij8u51i2teYxizcxXu6lPjCAyL4Lcg/PcYoj7ekYvajhfDkDuc/qxqfCcZmbXFb/FfB/oYpzzuz51uBCdjIl5xOLSHgxJJ35Hwg9ISZ8J9sxJWYHgrIRWfHOZs5X+3c6KpyhHo9gsVJBKEUg9OqfDDQZd4h/82Q5UfdOzEEizoLb9KR56JlI91ZxLBeGuaKCCaP/vW6rDeOXrosYD4F+NK2U6QCsSp1BbgsdqDTNWFPPfaopbFgnUH3MmypcTBKHCgyK1gcSlJNUunBuSDHu+7wjmq8sovwnWtv2ALnMJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9AxvuiLTidJZLzsL7XPg+ZQu/s8vQBGlBV+NSSgHRNg=; b=SZjDlbZk31YGNhCuShcbyS6kK1b+vvc5pDXAvwnXch7pMCyiECHYYyt/0+h1yPplqHPdZrs1/W2EFk0QKiq9+EIIEfjFuxpdHH7s4n+LnYcXSAkb1QvJGdnaUH+NGtQYZYDJ+tg9Gh5mPPD474bR+PKoZHavEW96OOA2s95V9lY= Received: from SN6PR11MB2814.namprd11.prod.outlook.com (2603:10b6:805:55::15) by SN6PR11MB2559.namprd11.prod.outlook.com (2603:10b6:805:57::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Thu, 1 Oct 2020 17:25:11 +0000 Received: from SN6PR11MB2814.namprd11.prod.outlook.com ([fe80::4540:a6b5:b0bc:9d82]) by SN6PR11MB2814.namprd11.prod.outlook.com ([fe80::4540:a6b5:b0bc:9d82%4]) with mapi id 15.20.3433.035; Thu, 1 Oct 2020 17:25:11 +0000 From: "Chiu, Chasel" To: "Desimone, Nathaniel L" , "devel@edk2.groups.io" CC: Liming Gao , "Dong, Eric" Subject: Re: [edk2-platforms] [PATCH V1 1/2] MinPlatformPkg: Add missing bounds checks to CompressLib Thread-Topic: [edk2-platforms] [PATCH V1 1/2] MinPlatformPkg: Add missing bounds checks to CompressLib Thread-Index: AQHWlr7dgfR3zugmwkKSlTUD1VXbIKmDAeuw Date: Thu, 1 Oct 2020 17:25:10 +0000 Message-ID: References: <20200930001529.2212-1-nathaniel.l.desimone@intel.com> <20200930001529.2212-2-nathaniel.l.desimone@intel.com> In-Reply-To: <20200930001529.2212-2-nathaniel.l.desimone@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [220.129.247.212] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 03902e4c-f919-46d7-c46b-08d8662ef367 x-ms-traffictypediagnostic: SN6PR11MB2559: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:983; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NIg0yWzR5pwBR1KmG38Q6wDENfMyOVt9wBOYZMdjniVpWfx4I1TXoegrthHxoMD5bWy6exvmGFriv7MWDgh7laClzLT2RO3v2SMJhsK3u4QS5r2WY4UsI9k2n7OCej+iwr607IRywNElFtaoc0/gY/my855BgePIu8EacZGF9GcTDP0g3w+qTKxHKWFpiwirlabV/Nmldi9JdChNoEVD+tiGUFyCmV+7TPdK0H71e4s8YDoGVK8AT/dV1VuLBnBvnKDSEEV3k+Yi5UKunTULveaaKK94/t6x+rD/6bPDh+aOKDDLB2EoN6Da2Vf3DKvAsoEbnbb6k7WtkN/kw1Zjg9yvTMFv7JM9fuHNQb7q9TwZQq7JQqKAdB6F0NfBowcE x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR11MB2814.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(376002)(396003)(136003)(346002)(366004)(64756008)(66556008)(26005)(66446008)(8676002)(52536014)(110136005)(83380400001)(478600001)(33656002)(76116006)(4326008)(55016002)(66476007)(107886003)(66946007)(186003)(2906002)(7696005)(53546011)(316002)(6506007)(5660300002)(71200400001)(9686003)(8936002)(86362001)(54906003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: RjCVp5MXC0/yZRnTCnkn8VtR5hnn0kjp1wD7DcZkIAGr+H2at29272dv7XNZJyFz8CUS3dK8UU6i3CE+Dodl0iM/evHfkUx/Mfz5bXb86uqHRfkBMmdWHGa4vd+yDvAFQjhDogcTShHiwjEINOXFqqyEfVEPpDTyS9CdOnU1F1dAGZNqGY/Y9MDTXQkbiRhiCz2sd9R9C0KaAfnjSfdFcnls+0ZgNlAIKB0ClD6W1FgWC+7JkZ4LGmvnmsauT1oqTvQULUnCPh3Uvk7sNAtuVB2tWdtTN8mhe7kMMFqPXJtOmkxWkWZQjH/NGWRFYzfNG3lL6oET+xxK0wCAw/Qk7WvvH/QMdz/1DrYIZdwTKsHoZ5nVWt8OCpA8gkFoH06D0a+pV+I9zPE0GjLPzpiqaJH1kyxDgyH3Yuw7vjIN6VXPIMkcxFKzJd9C37UgpYshsxDmOUv/9+sMifsVb1U1yQxMRaOXQDPqZdoovneLICogzHFp6TQfPx0VTLyyKlvSn0rNBA/qcd32U4iy/gOl3q2CCQ2UsI/5Qn4+sj5YT2weCpATzNKeAIOf+AMWhNjUHD2lp6a0fBpsg2yWIZUtKx63tgSVdAd949niqdvUBrKAB+r8fAmbeizlG6TIInUx9adovqup6Rsxmikw5SHaIQ== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2814.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03902e4c-f919-46d7-c46b-08d8662ef367 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Oct 2020 17:25:10.9498 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 5Yq5XjjUhTfsTeAVlWgbBBXRjr1zz77Xirp2iLxlbYl7qtECj6d73i2+rR3enAzk8gicuBt3DNwpB+bFR/HpNQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB2559 Return-Path: chasel.chiu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Chasel Chiu > -----Original Message----- > From: Nate DeSimone > Sent: Wednesday, September 30, 2020 8:15 AM > To: devel@edk2.groups.io > Cc: Chiu, Chasel ; Liming Gao > ; Dong, Eric > Subject: [edk2-platforms] [PATCH V1 1/2] MinPlatformPkg: Add missing boun= ds > checks to CompressLib >=20 > Current code only as bounds checks in ASSERT macros. > They are also needed in release mode where ASSERT is not used. >=20 > Signed-off-by: Nate DeSimone > Cc: Chasel Chiu > Cc: Nate DeSimone > Cc: Liming Gao > Cc: Eric Dong > --- > .../MinPlatformPkg/Library/CompressLib/CompressLib.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) >=20 > diff --git a/Platform/Intel/MinPlatformPkg/Library/CompressLib/CompressLi= b.c > b/Platform/Intel/MinPlatformPkg/Library/CompressLib/CompressLib.c > index 9f93e1ee2d..537eb3b693 100644 > --- a/Platform/Intel/MinPlatformPkg/Library/CompressLib/CompressLib.c > +++ b/Platform/Intel/MinPlatformPkg/Library/CompressLib/CompressLib.c > @@ -1002,7 +1002,10 @@ CountTFreq ( > mTFreq[2]++; > } > } else { > - ASSERT((LoopVar3+2)<(2 * NT - 1)); > + ASSERT ((LoopVar3 + 2) < (2 * NT - 1)); > + if ((LoopVar3 + 2) >=3D (2 * NT - 1)) { > + return; > + } > mTFreq[LoopVar3 + 2]++; > } > } > @@ -1101,7 +1104,10 @@ WriteCLen ( > PutBits (CBIT, Count - 20); > } > } else { > - ASSERT((LoopVar3+2) + ASSERT ((LoopVar3 + 2) < NPT); > + if ((LoopVar3 + 2) >=3D NPT) { > + return; > + } > PutBits (mPTLen[LoopVar3 + 2], mPTCode[LoopVar3 + 2]); > } > } > -- > 2.27.0.windows.1