[PATCH] Fix undefined behavior (shift of negative value) in RuntimeDyldMachOAArch64::encodeAddend.
Lang Hames
lhames at gmail.com
Thu Jan 15 10:33:25 PST 2015
Apologies for not getting to this. Thanks for the patch Alexey, and thanks
Chandler for the review!
- Lang.
On Fri, Jan 9, 2015 at 4:47 PM, Alexey Samsonov <vonosmas at gmail.com> wrote:
> REPOSITORY
> rL LLVM
>
> http://reviews.llvm.org/D6908
>
> Files:
>
> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h
>
> Index:
> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h
> ===================================================================
> ---
> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h
> +++
> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h
> @@ -183,8 +183,8 @@
> assert(isInt<33>(Addend) && "Invalid page reloc value.");
>
> // Encode the addend into the instruction.
> - uint32_t ImmLoValue = (uint32_t)(Addend << 17) & 0x60000000;
> - uint32_t ImmHiValue = (uint32_t)(Addend >> 9) & 0x00FFFFE0;
> + uint32_t ImmLoValue = ((uint64_t)Addend << 17) & 0x60000000;
> + uint32_t ImmHiValue = ((uint64_t)Addend >> 9) & 0x00FFFFE0;
> *p = (*p & 0x9F00001F) | ImmHiValue | ImmLoValue;
> break;
> }
>
> EMAIL PREFERENCES
> http://reviews.llvm.org/settings/panel/emailpreferences/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150115/07a02b7c/attachment.html>
More information about the llvm-commits
mailing list