public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Uefi functions AddUnicodeString2() and LookupUnicodeString2() are returning EFI_UNSUPPORTED incorrectly
@ 2021-02-05  6:30 chandramohan.akula
  0 siblings, 0 replies; only message in thread
From: chandramohan.akula @ 2021-02-05  6:30 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1697 bytes --]

Hi,

The library functions AddUnicodeString2() and LookupUnicodeString2() defined in UefiLib.c are returning EFI_UNSUPPORTED incorrectly.
These functions are returning EFI_UNSUPPORTED because of not finding the given "Language" in "SupportedLanguages", even though it is part of it.
Actually the function caller passing the supported language as ""en-US;ja-JP;zh-Hans"  and the language as "en-US" to those two functions.
The above two functions are passing arguments incorrectly to the function IsLanguageSupported(). The function IsLanguageSupported() is expecting first argument "SupportedLanguages" and second argument "TargetLanguage".
But these functions are passing "TargetLanguage" as first and "SupportedLanguages" as second one.  Due to this,  IsLanguageSupported() function returns that a given language is not supported

I have filed a bug for this https://bugzilla.tianocore.org/show_bug.cgi?id=3211
And attached the following patch:

diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/UefiLib.c
index 835218f982..b6a33a0a48 100644
--- a/MdePkg/Library/UefiLib/UefiLib.c
+++ b/MdePkg/Library/UefiLib/UefiLib.c
@@ -839,7 +839,7 @@ LookupUnicodeString2 (
SupportedLanguages += 3;
}
} else {
-    Found = !IsLanguageSupported(Language, SupportedLanguages);
+    Found = !IsLanguageSupported(SupportedLanguages, Language);
}

@@ -1133,7 +1133,7 @@ AddUnicodeString2 (
SupportedLanguages += 3;
}
} else {
-    Found = !IsLanguageSupported(Language, SupportedLanguages);
+    Found = !IsLanguageSupported(SupportedLanguages, Language);
}
//
// If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED

[-- Attachment #2: Type: text/html, Size: 2254 bytes --]

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-05  6:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-05  6:30 Uefi functions AddUnicodeString2() and LookupUnicodeString2() are returning EFI_UNSUPPORTED incorrectly chandramohan.akula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox