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:
@ -748,12 +748,17 @@ GetAllocationDescriptorLsn (
|
|||||||
IN VOID *Ad
|
IN VOID *Ad
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
UDF_PARTITION_DESCRIPTOR *PartitionDesc;
|
||||||
|
|
||||||
if (RecordingFlags == LongAdsSequence) {
|
if (RecordingFlags == LongAdsSequence) {
|
||||||
return GetLongAdLsn (Volume, (UDF_LONG_ALLOCATION_DESCRIPTOR *)Ad);
|
return GetLongAdLsn (Volume, (UDF_LONG_ALLOCATION_DESCRIPTOR *)Ad);
|
||||||
} else if (RecordingFlags == ShortAdsSequence) {
|
} else if (RecordingFlags == ShortAdsSequence) {
|
||||||
|
PartitionDesc = GetPdFromLongAd (Volume, ParentIcb);
|
||||||
|
ASSERT (PartitionDesc != NULL);
|
||||||
|
|
||||||
return GetShortAdLsn (
|
return GetShortAdLsn (
|
||||||
Volume,
|
Volume,
|
||||||
GetPdFromLongAd (Volume, ParentIcb),
|
PartitionDesc,
|
||||||
(UDF_SHORT_ALLOCATION_DESCRIPTOR *)Ad
|
(UDF_SHORT_ALLOCATION_DESCRIPTOR *)Ad
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user