]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/UdfDxe: Resolve potential NULL pointer dereference
authorHao Wu <hao.a.wu@intel.com>
Tue, 26 Sep 2017 01:14:08 +0000 (09:14 +0800)
committerHao Wu <hao.a.wu@intel.com>
Wed, 27 Sep 2017 11:09:25 +0000 (19:09 +0800)
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>
MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c

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