MdeModulePkg/UdfDxe: Resolve potential NULL pointer dereference

Within function GetAllocationDescriptorLsn():

The call to GetPdFromLongAd() may return NULL and it will be later
dereferenced in GetShortAdLsn().

This commit adds ASSERT to resolve the potential NULL pointer
dereference.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Paulo Alcantara <pcacjr@zytor.com>
This commit is contained in:
Hao Wu 2017-09-26 09:14:08 +08:00
parent 36d083ef00
commit ce9aaba64e
1 changed files with 6 additions and 1 deletions

View File

@ -748,12 +748,17 @@ GetAllocationDescriptorLsn (
IN VOID *Ad
)
{
UDF_PARTITION_DESCRIPTOR *PartitionDesc;
if (RecordingFlags == LongAdsSequence) {
return GetLongAdLsn (Volume, (UDF_LONG_ALLOCATION_DESCRIPTOR *)Ad);
} else if (RecordingFlags == ShortAdsSequence) {
PartitionDesc = GetPdFromLongAd (Volume, ParentIcb);
ASSERT (PartitionDesc != NULL);
return GetShortAdLsn (
Volume,
GetPdFromLongAd (Volume, ParentIcb),
PartitionDesc,
(UDF_SHORT_ALLOCATION_DESCRIPTOR *)Ad
);
}