diff options
author | Pavel Labath <pavel@labath.sk> | 2019-04-05 08:43:54 +0000 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2019-04-05 08:43:54 +0000 |
commit | ebdc698dbc00ee9c48d2c022bf2a7c828f696674 (patch) | |
tree | 6444ff97dab1a4e9e88f07abbe19b0f3a58b0eee /llvm/lib/Object/Minidump.cpp | |
parent | 92db30fc004b941cbabec52c0c8f5e3dcb953902 (diff) | |
download | bcm5719-llvm-ebdc698dbc00ee9c48d2c022bf2a7c828f696674.tar.gz bcm5719-llvm-ebdc698dbc00ee9c48d2c022bf2a7c828f696674.zip |
Fix r357749 for big-endian architectures
We need to read the strings from the minidump files as little-endian,
regardless of the host byte order.
I definitely remember thinking about this case while writing the patch
(and in fact, I have implemented that for the "write" case), but somehow
I have ended up not implementing the byte swapping when reading the
data. This adds the necessary byte-swapping and should hopefully fix
test failures on big-endian bots.
llvm-svn: 357754
Diffstat (limited to 'llvm/lib/Object/Minidump.cpp')
-rw-r--r-- | llvm/lib/Object/Minidump.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Object/Minidump.cpp b/llvm/lib/Object/Minidump.cpp index 3e3255a2f17..1a22491ce3c 100644 --- a/llvm/lib/Object/Minidump.cpp +++ b/llvm/lib/Object/Minidump.cpp @@ -38,12 +38,16 @@ Expected<std::string> MinidumpFile::getString(size_t Offset) const { return ""; Offset += sizeof(support::ulittle32_t); - auto ExpectedData = getDataSliceAs<UTF16>(getData(), Offset, Size); + auto ExpectedData = + getDataSliceAs<support::ulittle16_t>(getData(), Offset, Size); if (!ExpectedData) return ExpectedData.takeError(); + SmallVector<UTF16, 32> WStr(Size); + copy(*ExpectedData, WStr.begin()); + std::string Result; - if (!convertUTF16ToUTF8String(*ExpectedData, Result)) + if (!convertUTF16ToUTF8String(WStr, Result)) return createError("String decoding failed"); return Result; |