mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
Make UTF8->UTF16 conversion null terminate output on empty input.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228527 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2ba70e81a4
commit
3afd6d0734
@ -135,8 +135,11 @@ bool convertUTF8ToUTF16String(StringRef SrcUTF8,
|
||||
assert(DstUTF16.empty());
|
||||
|
||||
// Avoid OOB by returning early on empty input.
|
||||
if (SrcUTF8.empty())
|
||||
if (SrcUTF8.empty()) {
|
||||
DstUTF16.push_back(0);
|
||||
DstUTF16.pop_back();
|
||||
return true;
|
||||
}
|
||||
|
||||
const UTF8 *Src = reinterpret_cast<const UTF8 *>(SrcUTF8.begin());
|
||||
const UTF8 *SrcEnd = reinterpret_cast<const UTF8 *>(SrcUTF8.end());
|
||||
|
Loading…
x
Reference in New Issue
Block a user