public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "wang xiaofeng" <winggundum82@163.com>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	 "Dong, Eric" <eric.dong@intel.com>
Subject: SetUnicodeMem in DisplayEngineDxe seems unsafe
Date: Tue, 24 Jan 2017 15:56:29 +0800 (CST)	[thread overview]
Message-ID: <427ee1e3.4404.159cf79e45f.Coremail.winggundum82@163.com> (raw)
In-Reply-To: <3d6f0ddd.45de.1599650c94c.Coremail.winggundum82@163.com>

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%. 




  reply	other threads:[~2017-01-24  7:56 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         ` wang xiaofeng [this message]
2017-01-25  0:54           ` SetUnicodeMem in DisplayEngineDxe seems unsafe Gao, Liming
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=427ee1e3.4404.159cf79e45f.Coremail.winggundum82@163.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