public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "wenyi,xie" <xiewenyi2@huawei.com>
To: "Ni, Ray" <ray.ni@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Justen, Jordan L" <jordan.l.justen@intel.com>,
	"afish@apple.com" <afish@apple.com>
Cc: "songdongkuang@huawei.com" <songdongkuang@huawei.com>
Subject: Re: [edk2-devel] [PATCH EDK2 v1 1/1] EmulatorPkg/host: fix overflow in Mult
Date: Wed, 23 Sep 2020 10:58:34 +0800	[thread overview]
Message-ID: <5407ea33-49fa-1920-ceb9-abcd832ed802@huawei.com> (raw)
In-Reply-To: <BY5PR11MB40073D2674AAF9F9AAEEDE998C380@BY5PR11MB4007.namprd11.prod.outlook.com>

OK, Thanks.

Regards
Wenyi

On 2020/9/23 10:48, Ni, Ray wrote:
> Reviewed-by: Ray Ni <ray.ni@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.justen@intel.com>;
>> afish@apple.com; Ni, Ray <ray.ni@intel.com>
>> Cc: songdongkuang@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.justen@intel.com>
>>> Cc: Andrew Fish <afish@apple.com>
>>> Cc: Ray Ni <ray.ni@intel.com>
>>> Signed-off-by: Wenyi Xie <xiewenyi2@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
>>>
>>
>>
>> 
>>
> 

      reply	other threads:[~2020-09-23  2:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01 10:58 [PATCH EDK2 v1 0/1] EmulatorPkg/host: fix overflow in Mult wenyi,xie
2020-09-01 10:58 ` [PATCH EDK2 v1 1/1] " wenyi,xie
2020-09-02  6:54   ` [edk2-devel] " Laszlo Ersek
2020-09-22  3:42   ` wenyi,xie
2020-09-23  2:48     ` [edk2-devel] " Ni, Ray
2020-09-23  2:58       ` wenyi,xie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5407ea33-49fa-1920-ceb9-abcd832ed802@huawei.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox