From: Hao Wu Date: Tue, 26 Sep 2017 01:14:08 +0000 (+0800) Subject: MdeModulePkg/UdfDxe: Resolve potential NULL pointer dereference X-Git-Tag: edk2-stable201903~3319 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=ce9aaba64e07d7e12eb160ae32cde7b3357ce388 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 Cc: Star Zeng Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu Reviewed-by: Paulo Alcantara --- diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c index b336ffc553..e048d95d31 100644 --- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c +++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c @@ -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 ); }