summaryrefslogtreecommitdiff
path: root/StdLib
diff options
context:
space:
mode:
authordarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>2012-07-18 18:23:25 +0000
committerdarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>2012-07-18 18:23:25 +0000
commitad07c107f752a1ff71a22660afa2b9f8bcaaec9a (patch)
tree36b9360e728ba6d5b66b91a756f6a4b991350fc5 /StdLib
parent532616bbd62bea0fe4873f2e7a57de7be9ba3976 (diff)
downloadedk2-platforms-ad07c107f752a1ff71a22660afa2b9f8bcaaec9a.tar.xz
StdLib/LibC/Uefi/Devices/Console/daConsole.c: Fix bug where unconvertable wide characters would cause the code to hang or generate an exception.
When the WideTtyCvt() function encountered an unconvertable character, it properly replaced it but did not update the byte count, numB, to 1 and instead left it at -1. This fix sets numB to 1 when an unconvertable character is replaced. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: tim.lewis@insidesw.com Reviewed-by: daryl.mcdaniel@intel.com Reviewed-by: erik.c.bjorge@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13540 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'StdLib')
-rw-r--r--StdLib/LibC/Uefi/Devices/Console/daConsole.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/StdLib/LibC/Uefi/Devices/Console/daConsole.c b/StdLib/LibC/Uefi/Devices/Console/daConsole.c
index bfcc4a292c..4897a2e56e 100644
--- a/StdLib/LibC/Uefi/Devices/Console/daConsole.c
+++ b/StdLib/LibC/Uefi/Devices/Console/daConsole.c
@@ -77,8 +77,9 @@ WideTtyCvt( CHAR16 *dest, const char *buf, ssize_t n, mbstate_t *Cs)
if( numB == 0) {
break;
};
- if(numB < 0) {
+ if(numB < 0) { // If an unconvertable character, replace it.
wc[0] = BLOCKELEMENT_LIGHT_SHADE;
+ numB = 1;
}
if(wc[0] == L'\n') {
*dest++ = L'\r';