diff options
| author | Ard Biesheuvel <ardb@kernel.org> | 2026-09-12 16:26:26 +0300 |
|---|---|---|
| committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2026-09-21 11:46:42 +0300 |
| commit | 5ccee5217c6de6173448920aa0280474b4f44a14 (patch) | |
| tree | 5837706b2bbb1dba3756c0bd6fa402bc83673711 /UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem | |
| parent | 586194e3067e914a00e06a85960acd71ad688867 (diff) | |
| download | edk2-5ccee5217c6de6173448920aa0280474b4f44a14.tar.xz | |
MdePkg/BasePrintLib: Limit UCS-2 to ASCII conversion to Latin-1
Only ASCII and Latin-1 characters can be cast between CHAR8 and CHAR16
transparently, other characters in the UCS-2 set cannot be represented
at all.
So when handling the %s conversion while generating a narrow string,
replace characters outside of the Latin-1 range with a '?' character
instead of producing garbage output, which may truncate the output
string inadvertently if the UCS-2 low byte happens to equal \0.
When the input and output character widths are the same, the encoding
does not matter and the input can simply be copied to the output.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem')
0 files changed, 0 insertions, 0 deletions
