diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2016-09-30 12:29:24 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2016-10-09 10:18:35 +0800 |
commit | 4558491f8717c2ff8d1a3eeb1cd2af7322758612 (patch) | |
tree | c6ed2997c265328f4973a0c1c8e1c9dda373211f /MdeModulePkg | |
parent | 202726b3ceb33576ac6feb778e48bd851bfe171e (diff) | |
download | edk2-4558491f8717c2ff8d1a3eeb1cd2af7322758612.tar.gz edk2-4558491f8717c2ff8d1a3eeb1cd2af7322758612.tar.bz2 edk2-4558491f8717c2ff8d1a3eeb1cd2af7322758612.zip |
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>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c index 1e3f3bd1c8..33dbc7d5d5 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:
|