[PATCH] Fix signed overflow in encoder for ARM adr instruction

Mihail Popa mihail.popa at gmail.com
Tue Aug 13 02:05:49 PDT 2013


Hi. Please review the attached patch.

This fixes a signed overflow which can make ADR add to be encoded as an ADR
sub.
ADR uses different encoding bits to specify whether the immediate is to be
added
or subtracted. As such it is possible to add or subtract a 32-bit unsigned
number.
The cast to int32_t is undefined and triggers incorrect encoding. Keeping
the original
int64_t type is safe, as all subsequent casts are to uint32_t.

Thanks,
Mihai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130813/6dc5af56/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LLVM-816.adrover.patch
Type: application/octet-stream
Size: 1660 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130813/6dc5af56/attachment.obj>


More information about the llvm-commits mailing list