[PATCH] D34159: Fix a bug introduced in r305092 on big-endian systems.

Eric Beckmann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 12:13:52 PDT 2017


ecbeckmann created this revision.
Herald added a subscriber: hiraditya.

We were writing the length of the string based on system-endianness, and
not universally little-endian.  This fixes that.


https://reviews.llvm.org/D34159

Files:
  llvm/lib/Object/WindowsResource.cpp


Index: llvm/lib/Object/WindowsResource.cpp
===================================================================
--- llvm/lib/Object/WindowsResource.cpp
+++ llvm/lib/Object/WindowsResource.cpp
@@ -693,7 +693,7 @@
   uint32_t TotalStringTableSize = 0;
   for (auto String : StringTable) {
     auto *LengthField =
-        reinterpret_cast<uint16_t *>(BufferStart + CurrentOffset);
+        reinterpret_cast<support::ulittle16_t *>(BufferStart + CurrentOffset);
     uint16_t Length = String.size();
     *LengthField = Length;
     CurrentOffset += sizeof(uint16_t);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34159.102381.patch
Type: text/x-patch
Size: 565 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170613/a6863f08/attachment.bin>


More information about the llvm-commits mailing list