From 1481a4e7b6d4fd40143b263f4745d00eb4020627 Mon Sep 17 00:00:00 2001 From: Marek Sokolowski Date: Thu, 21 Sep 2017 20:36:38 +0000 Subject: [PATCH] [llvm-readobj] Fix big-endian byte swap in WindowsResourceDumper. The previous version of dumper implemented UTF-16 byte swap incorrectly on big-endian machines. This now gets fixed. Thanks to Bill Seurer for testing the patch locally. Differential Review: https://reviews.llvm.org/D38150 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313912 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-readobj/WindowsResourceDumper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/llvm-readobj/WindowsResourceDumper.cpp b/tools/llvm-readobj/WindowsResourceDumper.cpp index a1ca929418f..ac2745fdf3b 100644 --- a/tools/llvm-readobj/WindowsResourceDumper.cpp +++ b/tools/llvm-readobj/WindowsResourceDumper.cpp @@ -29,7 +29,7 @@ std::string stripUTF16(const ArrayRef &UTF16Str) { for (UTF16 Ch : UTF16Str) { // UTF16Str will have swapped byte order in case of big-endian machines. // Swap it back in such a case. - support::ulittle16_t ChValue(Ch); + uint16_t ChValue = support::endian::byte_swap(Ch, support::little); if (ChValue <= 0xFF) Result += ChValue; else -- 2.40.0