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>
This commit is contained in:
Hao Wu 2018-10-09 11:03:27 +08:00
parent ebb12f5142
commit 5fb22f5920
2 changed files with 18 additions and 0 deletions

View File

@ -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;

View File

@ -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) {
//