diff options
author | Hao Wu <hao.a.wu@intel.com> | 2018-10-09 11:03:27 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2018-10-18 09:12:41 +0800 |
commit | 5fb22f5920039393f74030c74c216517a131dbe0 (patch) | |
tree | 26a5becae0d5fe2501ce01fb1fcecc13c82dc150 /MdeModulePkg/Universal/Disk | |
parent | ebb12f514287696ed916d722a03eb49e7cab2ff0 (diff) | |
download | edk2-5fb22f5920039393f74030c74c216517a131dbe0.tar.gz edk2-5fb22f5920039393f74030c74c216517a131dbe0.tar.bz2 edk2-5fb22f5920039393f74030c74c216517a131dbe0.zip |
MdeModulePkg/UdfDxe: ASSERT for false positives of NULL ptr deref
This commit adds ASSERTs to address false positive reports of NULL
pointer dereference issues raised from static analysis with regard to
function ReadDirectoryEntry().
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Diffstat (limited to 'MdeModulePkg/Universal/Disk')
-rw-r--r-- | MdeModulePkg/Universal/Disk/UdfDxe/File.c | 9 | ||||
-rw-r--r-- | MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/File.c b/MdeModulePkg/Universal/Disk/UdfDxe/File.c index 6f07bf2066..2249f4ea0e 100644 --- a/MdeModulePkg/Universal/Disk/UdfDxe/File.c +++ b/MdeModulePkg/Universal/Disk/UdfDxe/File.c @@ -408,6 +408,15 @@ UdfRead ( goto Done;
}
+ //
+ // After calling function ReadDirectoryEntry(), if 'NewFileIdentifierDesc'
+ // is NULL, then the 'Status' must be EFI_OUT_OF_RESOURCES. Hence, if the
+ // code reaches here, 'NewFileIdentifierDesc' must be not NULL.
+ //
+ // The ASSERT here is for addressing a false positive NULL pointer
+ // dereference issue raised from static analysis.
+ //
+ ASSERT (NewFileIdentifierDesc != NULL);
if (!IS_FID_PARENT_FILE (NewFileIdentifierDesc)) {
break;
diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c index 638f31bd82..8b58cc9eb1 100644 --- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c +++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c @@ -1404,6 +1404,15 @@ InternalFindFile ( break;
}
+ //
+ // After calling function ReadDirectoryEntry(), if 'FileIdentifierDesc' is
+ // NULL, then the 'Status' must be EFI_OUT_OF_RESOURCES. Hence, if the code
+ // reaches here, 'FileIdentifierDesc' must be not NULL.
+ //
+ // The ASSERT here is for addressing a false positive NULL pointer
+ // dereference issue raised from static analysis.
+ //
+ ASSERT (FileIdentifierDesc != NULL);
if (FileIdentifierDesc->FileCharacteristics & PARENT_FILE) {
//
|