* [PATCH] BaseTools/Fmmt: Fix found the next FFS issue
@ 2020-05-09 7:00 Feng, YunhuaX
2020-06-08 0:33 ` Yuwei Chen
0 siblings, 1 reply; 2+ messages in thread
From: Feng, YunhuaX @ 2020-05-09 7:00 UTC (permalink / raw)
To: devel@edk2.groups.io; +Cc: Ni, Ray, Gao, Liming, Feng, Bob C
if the ffs size is invalid, break the iteration and return NOT_FOUND.
Cc: Ray Ni< ray.ni@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Change-Id: I9e320d6176af350ff208901209f3f6c89e4e1924
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
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/FmmtLib.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 = (UINTN)ALIGN_POINTER (*Key, 8)
) {
fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key);
fsize = GetFfsFileLength (fhdr);
+ //
+ //if the ffs size is invalid, break the loop
+ //the size defined in EFI_FFS_FILE_HEADER is 3 bytes.
+ //
+ if (fsize == (UINTN)((FvbAttributes & EFI_FVB2_ERASE_POLARITY) ? 0xFFFFFF : 0x0)) {
+ break;
+ }
if (!EFI_TEST_FFS_ATTRIBUTES_BIT(
FvbAttributes,
fhdr->State,
EFI_FILE_HEADER_VALID
) ||
--
2.12.2.windows.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] BaseTools/Fmmt: Fix found the next FFS issue
2020-05-09 7:00 [PATCH] BaseTools/Fmmt: Fix found the next FFS issue Feng, YunhuaX
@ 2020-06-08 0:33 ` Yuwei Chen
0 siblings, 0 replies; 2+ messages in thread
From: Yuwei Chen @ 2020-06-08 0:33 UTC (permalink / raw)
To: devel@edk2.groups.io, Feng, YunhuaX; +Cc: Ni, Ray, Gao, Liming, Feng, Bob C
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Feng,
> YunhuaX
> Sent: Saturday, May 9, 2020 3:01 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Gao, Liming <liming.gao@intel.com>; Feng,
> Bob C <bob.c.feng@intel.com>
> Subject: [edk2-devel] [PATCH] BaseTools/Fmmt: Fix found the next FFS issue
>
> if the ffs size is invalid, break the iteration and return NOT_FOUND.
>
> Cc: Ray Ni< ray.ni@intel.com>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
>
> Change-Id: I9e320d6176af350ff208901209f3f6c89e4e1924
> Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
> ---
> 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/FmmtLib.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 = (UINTN)ALIGN_POINTER (*Key, 8)
> ) {
> fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key);
> fsize = GetFfsFileLength (fhdr);
> + //
> + //if the ffs size is invalid, break the loop
> + //the size defined in EFI_FFS_FILE_HEADER is 3 bytes.
> + //
> + if (fsize == (UINTN)((FvbAttributes & EFI_FVB2_ERASE_POLARITY) ?
> 0xFFFFFF : 0x0)) {
> + break;
> + }
> if (!EFI_TEST_FFS_ATTRIBUTES_BIT(
> FvbAttributes,
> fhdr->State,
> EFI_FILE_HEADER_VALID
> ) ||
> --
> 2.12.2.windows.2
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-08 0:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-09 7:00 [PATCH] BaseTools/Fmmt: Fix found the next FFS issue Feng, YunhuaX
2020-06-08 0:33 ` Yuwei Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox