From 0c1541d457832d3f68158cf61d21c30fe32bb885 Mon Sep 17 00:00:00 2001 From: Shenglei Zhang Date: Tue, 15 Oct 2019 11:36:34 +0800 Subject: [PATCH] MdeModulePkg/SetupBrowserDxe: ASSERT GetBufferForValue(&Value) Before called by GetBufferForValue(), Value has already been called function IsTypeInBuffer to make sure the value must be buffer type. So GetBufferForValue can not return NULL. This commit adds ASSERT to assume (GetBufferForValue (&Value) is not NULL. Cc: Jian J Wang Cc: Hao A Wu Signed-off-by: Shenglei Zhang Reviewed-by: Dandan Bi --- MdeModulePkg/Universal/SetupBrowserDxe/Expression.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c index 7f4929c2fc..d273d2aac3 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c @@ -1281,7 +1281,10 @@ IfrToUint ( Result->Type = EFI_IFR_TYPE_UNDEFINED; return EFI_SUCCESS; } + + ASSERT (GetBufferForValue (&Value) != NULL); Result->Value.u64 = *(UINT64*) GetBufferForValue (&Value); + if (Value.Type == EFI_IFR_TYPE_BUFFER) { FreePool (Value.Buffer); }