From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web11.5933.1589007641000683522 for ; Sat, 09 May 2020 00:00:41 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=tNESe5GT; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: yunhuax.feng@intel.com) IronPort-SDR: MHveagt41KDs+bugbWtQwPcsoExoSGt+W5/cRnd5lNmh7CuQJ1vTU9xJcZnaUYhIEassSsEedW hUt8h+BTVgAw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2020 00:00:40 -0700 IronPort-SDR: g7ddNsOwY7AnSLzgt0dinRUKKqRoJciQC/GIbZ7vp/dC+xZ6SYtxx0J26pNHW5NQg0IHIZg5Zo ZKzZ59tOLveg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,370,1583222400"; d="scan'208";a="462544769" Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by fmsmga005.fm.intel.com with ESMTP; 09 May 2020 00:00:40 -0700 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) by ORSMSX101.amr.corp.intel.com (10.22.225.128) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 9 May 2020 00:00:40 -0700 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sat, 9 May 2020 00:00:39 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by orsmsx606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Sat, 9 May 2020 00:00:39 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.41) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 9 May 2020 00:00:39 -0700 Received: from BN8PR11MB3793.namprd11.prod.outlook.com (2603:10b6:408:86::23) by BN8PR11MB3665.namprd11.prod.outlook.com (2603:10b6:408:91::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Sat, 9 May 2020 07:00:37 +0000 Received: from BN8PR11MB3793.namprd11.prod.outlook.com ([fe80::6455:7f80:a3b2:730b]) by BN8PR11MB3793.namprd11.prod.outlook.com ([fe80::6455:7f80:a3b2:730b%5]) with mapi id 15.20.2979.033; Sat, 9 May 2020 07:00:37 +0000 From: "Feng, YunhuaX" To: "devel@edk2.groups.io" CC: "Ni, Ray" , "Gao, Liming" , "Feng, Bob C" Subject: [PATCH] BaseTools/Fmmt: Fix found the next FFS issue Thread-Topic: [PATCH] BaseTools/Fmmt: Fix found the next FFS issue Thread-Index: AdYlz4lL8B7hu+H4QOSGw1zwvPIU4g== Date: Sat, 9 May 2020 07:00:36 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.45] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2265eb28-1406-42d9-a4c5-08d7f3e6ad6a x-ms-traffictypediagnostic: BN8PR11MB3665: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3631; x-forefront-prvs: 03982FDC1D x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VLMWpenXyyj6xqRnH2JP8gp5QrFIn9L/t1qy4Gnda7ZafeVmmOd9bGPWI5+d0jZNonQspr/J4wcH49FE7404B9QwMmgHYd++MW9z+bEyWlG6Qw8Bcql1Lb3upmfY7thy0Ou//moYVCm6vB27saPXtmUQRPgUXo9de5NUnUNdUwthhRtJJZ/A7+fU8DrfGQ66IkF/VIYRC6x7gsLdZ2TZI7GZjV30PBzlz+7/aIp/3ca4trXeya6ebptc56v3jqbo//37nJjfHoSGGRxBhkinRecIwaAlOFVkpSqHWqNVapmXySlzH++8MYEIoXgG/4dxsiuJcAXiwnJiletg/L0lL5ujkJFXIuM3/nOIxZdVsHF7iTJlcUjFHq+DZtZDVC2ERRmWXquaemxFUDNQTdn9jUP85vMxJSY1DcQ2FxqRORFn72dABvkePuzN5RIlnSzhito3wl4nVy3MB9xDRzIdbl5L0v+COjHYVn9gnBlwbmTBxw5uSTh7qnc8L+DQJcy8uIqvgx1eXEKNT1oibNmWwg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR11MB3793.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(39860400002)(136003)(366004)(346002)(376002)(396003)(33430700001)(52536014)(55016002)(5660300002)(186003)(26005)(9686003)(8676002)(6506007)(7696005)(86362001)(107886003)(8936002)(4326008)(66446008)(66476007)(66556008)(64756008)(33656002)(66946007)(76116006)(6916009)(2906002)(33440700001)(54906003)(316002)(478600001)(71200400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: 3wLwpgKhPUda8lF5ADXEZLpnrxNUOQgVX8qhZLu6yezhkLfcujbn6boP4DPBavvTOT7otsMHmxHu/HnwnWcFQ8axVXXXnnRQtAdxMFMPon+hh0POnBMEE+ZXO/2xZ6UJp/2q9bTL9IkigQVB+SVsnTp9ksG87xLfG95hCYkVZU5uQl1KLYa2SksdqKhR3BGmv3sQYFYHpFyWIo2+Os1CBjzWtD/4gP17hdP0rdQtlx01mdY8J3nuGH/02wcgOpEOfQ0A+/HR2yfk1ucQIo48cnf6mkPHWDAOFKwjgJxNMvAK6naBnmHzKFN+6RE9vJqOxekcAovoXJ2XPcwQOoobu4ENZ9VDyfUTVn2/ePcElvopw13xOat0QE9d1yPJ37fbVaVDjOKqk630lWNbTGzqIZQwbZ1qqinoYxPmyLBId+4bDUB4V43rP8w8eU8LA/ig3EztJccdEc8qHlrGMk1+9yaBQF2WTTKX26WvZAj1fR0wfEPiGuqw09KqXAqt1Dml arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LYnCdgbHr5/I5LiSX7hK9Paydzoz5S3mY9+yJCUHBHWqbHexGETiBdVGmWGX8kA4moHRVrBrA9+aF/XUChTH61B8eL/sDDsD3Dh48JAuojGTKxte7lqweJl11gqo3Mcx3ZHvZRae8Bexq5u91NlWntHiAc8xblXij4QlFDfIzx2R4vtt5zRh1aSgTO8ooh2u5ek+XPxMBee5eCm88HIObTbmgTABaPkEWNaBfsjwry4oMElnnTMi+b19g9Oco9LiGVjrSV6XJPvj/06MaKVZ2CRsiNWRxOJateh/9kmg8ghxna4UTO/c6TraKQAVaPcJ2SRBEpByjF1me/6CvEFZyA== 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=nJAQFvDCoMVeU97rtTH6eSBRRPF/zvtVy5ll0vVxt/0=; b=OaxTzEyQuSbVyb1zaPo9GWko2cL822t0erm9wHm7W4sUZ8TSbHT1LBLs6QwuWfsMfLpD/BNKZoyzROVbnJYNGJlLOdnchR7rixcpni5U0ejdc6n/s1TWi0BBE5qX4hCCvGe1f1QUAIC9uwmr1EMdCmKxjvSrhdUWYwdBK8CK6mFh15SAbEX/amd+gRAhoNtDdWCY0EfFY6u1ikdmhjGUIt4UmNNcwC1CE2c02Qyp831ypBjV9SVg+c2xBcJ4hXFFA8Dj/ouuBQa/cb0c2VnFn6zq9oJyZrDeD9H+pFSAdm+0KXn44p1Yp7pfn2S/3y75dRq4GkTi09w480rLVXMXmg== 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=nJAQFvDCoMVeU97rtTH6eSBRRPF/zvtVy5ll0vVxt/0=; b=tNESe5GTmAmn10UlIAjLg1AD6ltC+IMB6FgiHgUwKHsKZB6PajYPZeF4+m5AYLtQFXwoPAswAiXaR70VSinA/xBTFo/rzJDaFwqCdU6xu1ZzVTSPP/+I6o8OryeAxEYr6ST4Jd0GypqXBnQ0dqfgRbwKtGSNXW6zkd11UDqNr2M= x-ms-exchange-crosstenant-network-message-id: 2265eb28-1406-42d9-a4c5-08d7f3e6ad6a x-ms-exchange-crosstenant-originalarrivaltime: 09 May 2020 07:00:36.9322 (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: SmqFqUGBJeLziOHJZREDOxYc6FoKy958rFxHkD94BOZ1XN3eT1VLHPSsfmqSeZUKTxSm7x67K/9QDgjD+ar/6A== x-ms-exchange-transport-crosstenantheadersstamped: BN8PR11MB3665 MIME-Version: 1.0 Return-Path: yunhuax.feng@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable if the ffs size is invalid, break the iteration and return NOT_FOUND. Cc: Ray Ni< ray.ni@intel.com> Cc: Bob Feng Cc: Liming Gao Change-Id: I9e320d6176af350ff208901209f3f6c89e4e1924 Signed-off-by: Yunhua Feng --- BaseTools/Source/C/FMMT/FmmtLib.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/Fm= mtLib.c index 9ec511ef06..6858cfe778 100644 --- a/BaseTools/Source/C/FMMT/FmmtLib.c +++ b/BaseTools/Source/C/FMMT/FmmtLib.c @@ -1769,10 +1769,17 @@ FvBufFindNextFile ( (*Key + sizeof (*fhdr)) < fvSize; *Key =3D (UINTN)ALIGN_POINTER (*Key, 8) ) { fhdr =3D (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key); fsize =3D GetFfsFileLength (fhdr); + // + //if the ffs size is invalid, break the loop + //the size defined in EFI_FFS_FILE_HEADER is 3 bytes. + // + if (fsize =3D=3D (UINTN)((FvbAttributes & EFI_FVB2_ERASE_POLARITY) ? 0= xFFFFFF : 0x0)) { + break; + } if (!EFI_TEST_FFS_ATTRIBUTES_BIT( FvbAttributes, fhdr->State, EFI_FILE_HEADER_VALID ) || -- 2.12.2.windows.2