]> git.proxmox.com Git - mirror_edk2.git/commit - MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
MdeModulePkg/Core: Fix potential array overflow
authorJian J Wang <jian.j.wang@intel.com>
Thu, 23 Nov 2017 00:56:46 +0000 (08:56 +0800)
committerHao Wu <hao.a.wu@intel.com>
Fri, 24 Nov 2017 00:35:29 +0000 (08:35 +0800)
commitc6c501654e85d712bc6381b1c9f2beb28b44ec68
treee6fa09a837853ca238b39f5b32bff03cddeeb140
parent938d2456fcd26a0940522c6bb185858f65930bb1
MdeModulePkg/Core: Fix potential array overflow

In the method DumpGuardedMemoryBitmap() and SetAllGuardPages(), the code
didn't check if the global mMapLevel is legal value or not, which leaves
a logic hole causing potential array overflow in code followed.

This patch adds sanity check before any array reference in those methods.

Cc: Wu Hao <hao.a.wu@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: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Wu Hao <hao.a.wu@intel.com>
MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
MdeModulePkg/Core/PiSmmCore/HeapGuard.c