mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
Make UTF8->UTF16 conversion null terminate output on empty input.
llvm-svn: 228527
This commit is contained in:
parent
9fae6cc7c6
commit
d65edd8565
@ -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…
Reference in New Issue
Block a user