Reviewed-by: Ray Ni <ray...@intel.com> Pull request was created: https://github.com/tianocore/edk2/pull/951
If you see any failures, please send updated patch to fix. > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of wenyi,xie > via groups.io > Sent: Tuesday, September 22, 2020 11:43 AM > To: devel@edk2.groups.io; Justen, Jordan L <jordan.l.jus...@intel.com>; > af...@apple.com; Ni, Ray <ray...@intel.com> > Cc: songdongku...@huawei.com > Subject: Re: [edk2-devel] [PATCH EDK2 v1 1/1] EmulatorPkg/host: fix overflow > in Mult > > Hi all, > > Please review this patch when you're free, thanks. > > Regards > Wenyi > > On 2020/9/1 18:58, Wenyi Xie wrote: > > 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.jus...@intel.com> > > Cc: Andrew Fish <af...@apple.com> > > Cc: Ray Ni <ray...@intel.com> > > Signed-off-by: Wenyi Xie <xiewen...@huawei.com> > > --- > > EmulatorPkg/Win/Host/WinHost.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/EmulatorPkg/Win/Host/WinHost.c > b/EmulatorPkg/Win/Host/WinHost.c > > index 0838c56ddea8..876cb8d4be8b 100644 > > --- a/EmulatorPkg/Win/Host/WinHost.c > > +++ b/EmulatorPkg/Win/Host/WinHost.c > > @@ -577,7 +577,7 @@ Returns: > > // > > // Save the size of the memory and make a Unicode filename > SystemMemory00, ... > > // > > - gSystemMemory[Index].Size = _wtoi (MemorySizeStr) * SIZE_1MB; > > + gSystemMemory[Index].Size = ((UINT64)_wtoi (MemorySizeStr)) * > ((UINT64)SIZE_1MB); > > > > // > > // Find the next region > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65486): https://edk2.groups.io/g/devel/message/65486 Mute This Topic: https://groups.io/mt/76553535/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-