public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Liming" <liming.gao@intel.com>
To: wang xiaofeng <winggundum82@163.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	"Dong, Eric" <eric.dong@intel.com>
Subject: Re: SetUnicodeMem in DisplayEngineDxe seems unsafe
Date: Wed, 25 Jan 2017 00:54:47 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D6D4671@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <427ee1e3.4404.159cf79e45f.Coremail.winggundum82@163.com>

Xiaofeng:
   Yes. This is a potential issue. This API should be updated with original Buffer Size. Could you help submit this issue in BugZillar? 

Thanks
Liming
>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>wang xiaofeng
>Sent: Tuesday, January 24, 2017 3:56 PM
>To: edk2-devel@lists.01.org; Dong, Eric <eric.dong@intel.com>
>Subject: [edk2] SetUnicodeMem in DisplayEngineDxe seems unsafe
>
>Hi DisplayEngineDxe  Owner,
>   SetUnicodeMem seems unsafe  since the buffer may overflow if the input
>Size is bigger than buffer size.Do we think about improve the function
>
>
>/**
>  Set Buffer to Value for Size bytes.
>
>
>  @param  Buffer                 Memory to set.
>  @param  Size                   Number of bytes to set
>  @param  Value                  Value of the set operation.
>
>
>**/
>VOID
>SetUnicodeMem (
>  IN VOID   *Buffer,
>  IN UINTN  Size,
>  IN CHAR16 Value
>  )
>{
>  CHAR16  *Ptr;
>
>
>  Ptr = Buffer;
>  while ((Size--)  != 0) {
>    *(Ptr++) = Value;
>  }
>}
>
>   The problem I meet is liking the following screen. Year in main page shows
>incorrect char randomly.
>
>   If I turn off GetNumericInput optimize with #pragma optimize( "", off ) in
>InputHandler.c , or swtich to use StrCpyS like this. The problem disappear. This
>issue cannot be seen in OVMF ,but it can be reproduced in our own platform
>with a rate of 30%.
>
>
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2017-01-25  0:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-04  7:13 unable to build update capsule image Iddamsetty, Aravind (Artesyn)
2017-01-04  8:00 ` Yao, Jiewen
2017-01-04  8:14 ` Yao, Jiewen
2017-01-04  8:51   ` Iddamsetty, Aravind (Artesyn)
2017-01-12  3:02   ` how to update capsule image with CapsuleApp wang xiaofeng
2017-01-12  3:26     ` Yao, Jiewen
2017-01-13  5:33       ` seems a minor logic error in UpdateCapsule of MdeModulePkg\Universal\CapsuleRuntimeDxe wang xiaofeng
2017-01-24  7:56         ` SetUnicodeMem in DisplayEngineDxe seems unsafe wang xiaofeng
2017-01-25  0:54           ` Gao, Liming [this message]
2017-01-25  2:21             ` wang xiaofeng
2017-01-25  2:29               ` Gao, Liming
2017-01-25  2:29               ` Dong, Eric
2017-01-25  2:48                 ` wang xiaofeng

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=4A89E2EF3DFEDB4C8BFDE51014F606A14D6D4671@shsmsx102.ccr.corp.intel.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