* [PATCH] MdeModulePkg/HiiDataBase: Fix NULL deference bug in HiiGetImageInfo
@ 2016-09-30 4:31 Ruiyu Ni
2016-09-30 5:36 ` Gao, Liming
0 siblings, 1 reply; 2+ messages in thread
From: Ruiyu Ni @ 2016-09-30 4:31 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao
The return value of GetImageIdOrAddress() could be NULL if the
ImageId is invalid. The patch fixes the bug to return EFI_NOT_FOUND
when GetImageIdOrAddress() returns NULL.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c
index 1e3f3bd..33dbc7d 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c
@@ -361,6 +361,10 @@ HiiGetImageInfo (
// Find the image block specified by ImageId
//
CurrentImageBlock = GetImageIdOrAddress (ImagePackage->ImageBlock, &ImageId);
+ if (CurrentImageBlock == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
switch (CurrentImageBlock->BlockType) {
case EFI_HII_IIBT_IMAGE_JPEG:
case EFI_HII_IIBT_IMAGE_PNG:
--
2.9.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] MdeModulePkg/HiiDataBase: Fix NULL deference bug in HiiGetImageInfo
2016-09-30 4:31 [PATCH] MdeModulePkg/HiiDataBase: Fix NULL deference bug in HiiGetImageInfo Ruiyu Ni
@ 2016-09-30 5:36 ` Gao, Liming
0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2016-09-30 5:36 UTC (permalink / raw)
To: Ni, Ruiyu, edk2-devel@lists.01.org
Signed-off-by: Liming Gao <liming.gao@intel.com>
> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Friday, September 30, 2016 12:31 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: [PATCH] MdeModulePkg/HiiDataBase: Fix NULL deference bug in
> HiiGetImageInfo
>
> The return value of GetImageIdOrAddress() could be NULL if the
> ImageId is invalid. The patch fixes the bug to return EFI_NOT_FOUND
> when GetImageIdOrAddress() returns NULL.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> ---
> MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c
> b/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c
> index 1e3f3bd..33dbc7d 100644
> --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c
> +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c
> @@ -361,6 +361,10 @@ HiiGetImageInfo (
> // Find the image block specified by ImageId
> //
> CurrentImageBlock = GetImageIdOrAddress (ImagePackage->ImageBlock,
> &ImageId);
> + if (CurrentImageBlock == NULL) {
> + return EFI_NOT_FOUND;
> + }
> +
> switch (CurrentImageBlock->BlockType) {
> case EFI_HII_IIBT_IMAGE_JPEG:
> case EFI_HII_IIBT_IMAGE_PNG:
> --
> 2.9.0.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-30 5:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-30 4:31 [PATCH] MdeModulePkg/HiiDataBase: Fix NULL deference bug in HiiGetImageInfo Ruiyu Ni
2016-09-30 5:36 ` Gao, Liming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox