[edk2-devel] [Patch] [edk2-staging] BaseTools: Add checkpoint for that there is no fv ext_header

Bob Feng posted 1 patch 2 years, 11 months ago
Failed in applying to current master (apply log)
BaseTools/Source/C/FMMT/FmmtLib.c | 2 ++
1 file changed, 2 insertions(+)
[edk2-devel] [Patch] [edk2-staging] BaseTools: Add checkpoint for that there is no fv ext_header
Posted by Bob Feng 2 years, 11 months ago
FMMT will crash if there is no fv ext_header in a specific FV.
This patch is going to add a check point for this case.

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---
 BaseTools/Source/C/FMMT/FmmtLib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c
index fa77ed7317..4f6056edba 100644
--- a/BaseTools/Source/C/FMMT/FmmtLib.c
+++ b/BaseTools/Source/C/FMMT/FmmtLib.c
@@ -4544,16 +4544,18 @@ LibEncapNewFvFile(
         if (CurrentEncapData != NULL) {
           LocalEncapData = CurrentEncapData;
           while (LocalEncapData->Level != ParentLevel) {
             LocalEncapData = LocalEncapData->NextNode;
           }
+          if (LocalEncapData->FvExtHeader !=NULL) {
             for (Index = 0; Index <= FvInFd->FfsNumbers; Index++) {
                 if ((memcmp(&FvInFd->FfsAttuibutes[Index].GuidName, &(LocalEncapData->FvExtHeader->FvName), sizeof(EFI_GUID)) == 0)) {
                     SubFvId = Index;
                     break;
                 }
             }
+          }
         }
         //
         // Found FFSs from Fv structure.
         //
         FfsFoundFlag = FALSE;
-- 
2.29.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75553): https://edk2.groups.io/g/devel/message/75553
Mute This Topic: https://groups.io/mt/83070312/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [Patch] [edk2-staging] BaseTools: Add checkpoint for that there is no fv ext_header
Posted by Yuwei Chen 2 years, 11 months ago
Reviewed-by: Yuwei Chen<yuwei.chen@intel.com>

> -----Original Message-----
> From: Feng, Bob C <bob.c.feng@intel.com>
> Sent: Tuesday, May 25, 2021 2:20 PM
> To: devel@edk2.groups.io
> Cc: Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine
> <yuwei.chen@intel.com>
> Subject: [Patch] [edk2-staging] BaseTools: Add checkpoint for that there is
> no fv ext_header
> 
> FMMT will crash if there is no fv ext_header in a specific FV.
> This patch is going to add a check point for this case.
> 
> Signed-off-by: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> ---
>  BaseTools/Source/C/FMMT/FmmtLib.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c
> b/BaseTools/Source/C/FMMT/FmmtLib.c
> index fa77ed7317..4f6056edba 100644
> --- a/BaseTools/Source/C/FMMT/FmmtLib.c
> +++ b/BaseTools/Source/C/FMMT/FmmtLib.c
> @@ -4544,16 +4544,18 @@ LibEncapNewFvFile(
>          if (CurrentEncapData != NULL) {
>            LocalEncapData = CurrentEncapData;
>            while (LocalEncapData->Level != ParentLevel) {
>              LocalEncapData = LocalEncapData->NextNode;
>            }
> +          if (LocalEncapData->FvExtHeader !=NULL) {
>              for (Index = 0; Index <= FvInFd->FfsNumbers; Index++) {
>                  if ((memcmp(&FvInFd->FfsAttuibutes[Index].GuidName,
> &(LocalEncapData->FvExtHeader->FvName), sizeof(EFI_GUID)) == 0)) {
>                      SubFvId = Index;
>                      break;
>                  }
>              }
> +          }
>          }
>          //
>          // Found FFSs from Fv structure.
>          //
>          FfsFoundFlag = FALSE;
> --
> 2.29.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75748): https://edk2.groups.io/g/devel/message/75748
Mute This Topic: https://groups.io/mt/83070312/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


[edk2-devel] 回复: [Patch] [edk2-staging] BaseTools: Add checkpoint for that there is no fv ext_header
Posted by gaoliming 2 years, 11 months ago
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: Chen, Christine <yuwei.chen@intel.com>
> 发送时间: 2021年5月27日 13:57
> 收件人: Feng, Bob C <bob.c.feng@intel.com>; devel@edk2.groups.io
> 抄送: Liming Gao <gaoliming@byosoft.com.cn>
> 主题: RE: [Patch] [edk2-staging] BaseTools: Add checkpoint for that there
is
> no fv ext_header
> 
> Reviewed-by: Yuwei Chen<yuwei.chen@intel.com>
> 
> > -----Original Message-----
> > From: Feng, Bob C <bob.c.feng@intel.com>
> > Sent: Tuesday, May 25, 2021 2:20 PM
> > To: devel@edk2.groups.io
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine
> > <yuwei.chen@intel.com>
> > Subject: [Patch] [edk2-staging] BaseTools: Add checkpoint for that there
is
> > no fv ext_header
> >
> > FMMT will crash if there is no fv ext_header in a specific FV.
> > This patch is going to add a check point for this case.
> >
> > Signed-off-by: Bob Feng <bob.c.feng@intel.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Yuwei Chen <yuwei.chen@intel.com>
> > ---
> >  BaseTools/Source/C/FMMT/FmmtLib.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c
> > b/BaseTools/Source/C/FMMT/FmmtLib.c
> > index fa77ed7317..4f6056edba 100644
> > --- a/BaseTools/Source/C/FMMT/FmmtLib.c
> > +++ b/BaseTools/Source/C/FMMT/FmmtLib.c
> > @@ -4544,16 +4544,18 @@ LibEncapNewFvFile(
> >          if (CurrentEncapData != NULL) {
> >            LocalEncapData = CurrentEncapData;
> >            while (LocalEncapData->Level != ParentLevel) {
> >              LocalEncapData = LocalEncapData->NextNode;
> >            }
> > +          if (LocalEncapData->FvExtHeader !=NULL) {
> >              for (Index = 0; Index <= FvInFd->FfsNumbers; Index++) {
> >                  if
> ((memcmp(&FvInFd->FfsAttuibutes[Index].GuidName,
> > &(LocalEncapData->FvExtHeader->FvName), sizeof(EFI_GUID)) == 0)) {
> >                      SubFvId = Index;
> >                      break;
> >                  }
> >              }
> > +          }
> >          }
> >          //
> >          // Found FFSs from Fv structure.
> >          //
> >          FfsFoundFlag = FALSE;
> > --
> > 2.29.1.windows.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75826): https://edk2.groups.io/g/devel/message/75826
Mute This Topic: https://groups.io/mt/83140957/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-