public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Liming" <liming.gao@intel.com>
To: "Wu, Hao A" <hao.a.wu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Bin . Lain" <bin_601@mail2000.com.tw>,
	"Yao, Jiewen" <jiewen.yao@intel.com>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Subject: Re: [PATCH] MdePkg/BaseLib: AsciiStrToUnicodeStr(S) not handle EASCII properly
Date: Fri, 19 Oct 2018 11:23:39 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E342F66@SHSMSX152.ccr.corp.intel.com> (raw)
In-Reply-To: <20181019030615.9716-1-hao.a.wu@intel.com>

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Wu, Hao A
> Sent: Friday, October 19, 2018 11:06 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Bin . Lain <bin_601@mail2000.com.tw>; Yao, Jiewen <jiewen.yao@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [PATCH] MdePkg/BaseLib: AsciiStrToUnicodeStr(S) not handle EASCII properly
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1262
> 
> Current implementation of BaseLib APIs:
> 
> AsciiStrToUnicodeStr()
> AsciiStrToUnicodeStrS()
> AsciiStrnToUnicodeStrS()
> 
> do not handle EASCII properly.
> 
> More specifically, if the value of ASCII character is larger than 0x7F,
> then the converted Unicode character will have all '1's in the higher 8
> bits.
> 
> An example:
>   0xC9 => 0xFFC9 (current implementations)
> and it should be:
>   0xC9 => 0x00C9
> 
> This commit will address this issue.
> 
> Cc: Bin.Lain <bin_601@mail2000.com.tw>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> ---
>  MdePkg/Library/BaseLib/SafeString.c | 4 ++--
>  MdePkg/Library/BaseLib/String.c     | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/MdePkg/Library/BaseLib/SafeString.c b/MdePkg/Library/BaseLib/SafeString.c
> index 29310889ca..417497cbc9 100644
> --- a/MdePkg/Library/BaseLib/SafeString.c
> +++ b/MdePkg/Library/BaseLib/SafeString.c
> @@ -2932,7 +2932,7 @@ AsciiStrToUnicodeStrS (
>    // Convert string
>    //
>    while (*Source != '\0') {
> -    *(Destination++) = (CHAR16)*(Source++);
> +    *(Destination++) = (CHAR16)(UINT8)*(Source++);
>    }
>    *Destination = '\0';
> 
> @@ -3045,7 +3045,7 @@ AsciiStrnToUnicodeStrS (
>    // Convert string
>    //
>    while ((*Source != 0) && (SourceLen > 0)) {
> -    *(Destination++) = (CHAR16)*(Source++);
> +    *(Destination++) = (CHAR16)(UINT8)*(Source++);
>      SourceLen--;
>      (*DestinationLength)++;
>    }
> diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c
> index cb90774c86..e6df12797d 100644
> --- a/MdePkg/Library/BaseLib/String.c
> +++ b/MdePkg/Library/BaseLib/String.c
> @@ -1746,7 +1746,7 @@ AsciiStrToUnicodeStr (
> 
>    ReturnValue = Destination;
>    while (*Source != '\0') {
> -    *(Destination++) = (CHAR16) *(Source++);
> +    *(Destination++) = (CHAR16)(UINT8) *(Source++);
>    }
>    //
>    // End the Destination with a NULL.
> --
> 2.12.0.windows.1



      reply	other threads:[~2018-10-19 11:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-19  3:06 [PATCH] MdePkg/BaseLib: AsciiStrToUnicodeStr(S) not handle EASCII properly Hao Wu
2018-10-19 11:23 ` Gao, Liming [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=4A89E2EF3DFEDB4C8BFDE51014F606A14E342F66@SHSMSX152.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