From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BC5162095E529 for ; Mon, 25 Sep 2017 18:33:40 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2017 18:36:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,438,1500966000"; d="scan'208";a="139385202" Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.13]) by orsmga002.jf.intel.com with ESMTP; 25 Sep 2017 18:36:50 -0700 From: Hao Wu To: edk2-devel@lists.01.org Cc: Hao Wu , Paulo Alcantara , Ruiyu Ni , Star Zeng , Eric Dong Date: Tue, 26 Sep 2017 09:36:48 +0800 Message-Id: <20170926013648.23788-1-hao.a.wu@intel.com> X-Mailer: git-send-email 2.12.0.windows.1 Subject: [PATCH] MdeModulePkg/UdfDxe: Resolve potential NULL pointer dereference X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Sep 2017 01:33:40 -0000 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: Paulo Alcantara Cc: Ruiyu Ni Cc: Star Zeng Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu --- MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 ); } -- 2.12.0.windows.1