Skip to content
Commit dd5c7e3c authored by wenyi,xie via groups.io's avatar wenyi,xie via groups.io Committed by mergify[bot]
Browse files

EmulatorPkg/host: fix overflow in Mult

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



When calculating memory regions and store the information in the
gSystemMemory in file WinHost.c, the code below will cause overflow,
because _wtoi (MemorySizeStr) return an int value and SIZE_1MB is
also an int value, if MemorySizeStr is lager for example 2048, then
result of multiplication will overflow.

for (Index = 0, Done = FALSE; !Done; Index++) {
  //
  // Save the size of the memory and make a Unicode filename SystemMemory00
  //
  gSystemMemory[Index].Size = _wtoi (MemorySizeStr) * SIZE_1MB;

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Reviewed-by: default avatarRay Ni <ray.ni@intel.com>
Signed-off-by: default avatarWenyi Xie <xiewenyi2@huawei.com>
parent 3f3daf89
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment