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

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 12:21:04 PDT 2017


I can't lgtm right no, not at computer. Can use llvm::support::write16le
instead of the pointer assignment? Otherwise lgtm
On Tue, Jun 13, 2017 at 12:13 PM Eric Beckmann via Phabricator <
reviews at reviews.llvm.org> wrote:

> 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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170613/a8822ada/attachment.html>


More information about the llvm-commits mailing list