From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.5961.1589007768937869711 for ; Sat, 09 May 2020 00:02:49 -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=BI011sJj; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: yunhuax.feng@intel.com) IronPort-SDR: n6DnTe4qNzbHcG6Dr3K89v9nnx85VK+4PiJbwAkEBG/f0W8N3MBjWVIkzHfTpoLqdkfplqPiDO SqiJ77LmUOcw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2020 00:02:48 -0700 IronPort-SDR: VEZBWcCbY4daPxH36GmqYQDc4vrYT3RLGxGYw7jMXiirT/exfENUis6H4uCyucCfNM6qB7waIj OyRion7mk8cw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,370,1583222400"; d="scan'208";a="250669399" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga007.fm.intel.com with ESMTP; 09 May 2020 00:02:48 -0700 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 9 May 2020 00:02:48 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 9 May 2020 00:02:47 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.105) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 9 May 2020 00:02:47 -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:02:45 +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:02:45 +0000 From: "Feng, YunhuaX" To: "devel@edk2.groups.io" CC: "Ni, Ray" , "Gao, Liming" , "Feng, Bob C" Subject: [edk2-staging][PATCH v2] BaseTools/Fmmt: Fix found the next FFS issue Thread-Topic: [edk2-staging][PATCH v2] BaseTools/Fmmt: Fix found the next FFS issue Thread-Index: AdYlz89dvAIJPsIDT6WNyOCkUfkoiQ== Date: Sat, 9 May 2020 07:02:45 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.2.0.6 dlp-reaction: no-action dlp-product: dlpe-windows 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.55.52.192] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bf69fec6-27fd-4301-bdeb-08d7f3e6f9bf 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: kehYbr1WhQhxiFQ6bxi989czGhBlJOPWL0VnQ2/LWlUClz8b4H4NnEZgWQ9p+ex+VGcPe1tNILdhc1aWfcJP9bME18EzvLJ0Ov0pSbBILA13up+1BnXZD3pY+hbfGQ9YHRv9CnsgPLpZnru7JdA9rF18CEVug32VZtc2NDto4+tX4YYSyEKVUEO9qC6C3KngsTBwfNaKA3KJUJL7hB/WfCn3xb5+dFQMo36q5ALP+giH2Uw3OsHfgDeQ3GeaV2H7Q6HwJGlOQ1idZyH3KiaBJwTNwHwoXHjZ557UDr05HDPudoFT/1lSw7Li6Tsedi4vWj2hInkUKlPFzhnxfPCXirjiz3BFOnG/XrxcotUI0c66I3652ryb36Xcn9UNzIWVRw/1Y4+sRQnqp+creaIKe648rec93+MhKfPNq0JN6Zl6CkcONg0JL5rT/UA060/RhP6Ezc8WHviCm0/CUxBLTT3mWrjTYiJyXcgpQumSckD+WHBKSqT7iUaJdmHIOJnnN8n0MbgIhTUqVBycr2QgoQ== 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: gO7/phWrssa+feEbvpxhV8vYXRG2+4HNl+HURwXBGQmuLgGIRpi4uFVlEwG3s307hgW7FUDDQpjnQ1TrshUyTID8HvsmSSW1suUSGaSEiUBqiwcFH5/RE4OCNKy74bjhwfVpcr42C3ONC2tU7/g5sIMO7I26fC+Lr8KLvfCOV9F3/KHpVYmon0tjTLjQ0stVrGZfRK4PBDzbXgFpe0zeaWX3Mc4+m4DY8diyCinSeiklHluUS2ajCihMSOKyEl2ixEaiDlVk4RUso8hbJgZ/z8ryoMFH50rt82Hz9/jSMb4BO0qVD9FZ7kO9CahwjkIjRNvpZyWia1JB0Acn3G3tf2eMsTQ32cOdCDZPexBmrHN7Zn1rpCwnzreZ4kfoNAsWGb7EqBorbSBFNUzOZYjlxAncFrGDZ2QWXIxliM2pH3zGJgtelU7WqqL89kzkUSCs5+TPdrTnrhACFNiGlDlZkkJLp+Hztove/g7qWDpKEMs= arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i4o6EfhsJNWYHHWtsOVtdaTIlkXz+HXsdu8Zk72WfNUW5voo1V3MXFeCdZnFhXZNAKUFy/oFKBDhHxZyc4O8hUnWsexRWcDk9s6llFj9sEbs4HC8LBSiKT3awCTEeCYvJOaB4Xvk/dWu+pjXgYoFyX1sfzZrKnQ1dt3f1/FyEisdcUebWU/n7UQEqeK+Ou/NmDF01WGkjfiRqArwRQi0ivfpbDYjk4EhtDab0pGLSzca+xsnAzosxN9c2IgaqJvkXxsIGLAWzRpmCAk87zcEs+IK6ReUFd2KEr/ChCrwGKbMQCmz7FjabBoWIwM+GFsi4O8aXugwXlaVReGHagFK8Q== 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=VXxn4WQKa434SlkGgjby1V9hoJGiF8+3xjlv+q606fI=; b=hy7f8N2CwJeZY/g0UVwdP1Emaz1BA9H1gXz34Nttan7DeHV2WRShbQ7C9nic6QWkY93MaoOfsQCaiWWL6dSr3JphsZnafynynkVTOGwVEazDV3jlZGtr24pJHRYWRmmj3RtWHQ8lmCKNsqKA4e3Gvhd6/NcyaYSv0VFMiKzcj7asi9+5ivfJPjWiyEMUoMQRKYRBR+d5zs+969pMrMdEmJJVHQtfuCQ7paFYfQ4+pIJs3qtTiIkYav1Vh/ze0XFhMLcalBBwNyu32CCNdE/Iu2gxIdBAfFkn0ZVU7tDKf53lPmoGxfN/k3ygPQHW9mCVkXOe2yrhu2YC3ZVtVRhMZQ== 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=VXxn4WQKa434SlkGgjby1V9hoJGiF8+3xjlv+q606fI=; b=BI011sJj+Wi1b16Ws/QkraTRzEaCGcaf4yr+4u9EZ6TbQzISEGRsiRtWDx1I7/JxMdgclPjUbebF58+ZeRWPAYFqLTW/w+4wEYlo9k79HGDKP9Za7fd9Xty8EsrZJIKBcKWScn4G9LYkn4R+LaYnm7i1fweGq2KIuMJtVqSdVow= x-ms-exchange-crosstenant-network-message-id: bf69fec6-27fd-4301-bdeb-08d7f3e6f9bf x-ms-exchange-crosstenant-originalarrivaltime: 09 May 2020 07:02:45.1786 (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: SHHr/LtSgAMb4hIO/REKpB8zOYRoCQRDsq9N+YgrG7g6Cr/a2HHpmLKMH+4j2Xwwekp/cCR8DIWWAi3hnuDpWQ== 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