]> git.proxmox.com Git - mirror_edk2.git/commit - MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
MdeModulePkg/UdfDxe: Avoid possible use of already-freed data
authorHao Wu <hao.a.wu@intel.com>
Tue, 16 Oct 2018 05:09:43 +0000 (13:09 +0800)
committerHao Wu <hao.a.wu@intel.com>
Tue, 23 Oct 2018 06:25:04 +0000 (14:25 +0800)
commit68099b52b0fcc1d45864154954d776d91afb33e0
treeeec1460c85596dd6d3a10495dfc151f470a4e8a8
parent85acb5e8ffef026b80241b1657ed4fba26e382b1
MdeModulePkg/UdfDxe: Avoid possible use of already-freed data

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1255

For function ReadFile():

If the line

  Status = GetAedAdsData (
   ...
   );

is reached multiple times during the 'for' loop, freeing the data pointed
by variable 'Data' may potentially lead to variable 'Ad' referencing the
already-freed data.

After calling function GetAllocationDescriptor(), 'Data' and 'Ad' may
point to the same memory (with some possible offset). Hence, this commit
will move the FreePool() call backwards to ensure the data will no longer
be used.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Acked-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c