[llvm-commits] [llvm] r138636 - /llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
Jim Grosbach
grosbach at apple.com
Fri Aug 26 11:26:00 PDT 2011
Testcase?
On Aug 26, 2011, at 11:21 AM, Benjamin Kramer wrote:
> Author: d0k
> Date: Fri Aug 26 13:21:36 2011
> New Revision: 138636
>
> URL: http://llvm.org/viewvc/llvm-project?rev=138636&view=rev
> Log:
> ARMDisassembler: Always return a size, even when disassembling fails.
>
> This should fix PR10772.
>
> Modified:
> llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
>
> Modified: llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp?rev=138636&r1=138635&r2=138636&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp (original)
> +++ llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp Fri Aug 26 13:21:36 2011
> @@ -262,8 +262,10 @@
> uint8_t bytes[4];
>
> // We want to read exactly 4 bytes of data.
> - if (Region.readBytes(Address, 4, (uint8_t*)bytes, NULL) == -1)
> + if (Region.readBytes(Address, 4, (uint8_t*)bytes, NULL) == -1) {
> + Size = 0;
> return Fail;
> + }
>
> // Encoded as a small-endian 32-bit word in the stream.
> uint32_t insn = (bytes[3] << 24) |
> @@ -329,6 +331,7 @@
>
> MI.clear();
>
> + Size = 0;
> return Fail;
> }
>
> @@ -442,8 +445,10 @@
> uint8_t bytes[4];
>
> // We want to read exactly 2 bytes of data.
> - if (Region.readBytes(Address, 2, (uint8_t*)bytes, NULL) == -1)
> + if (Region.readBytes(Address, 2, (uint8_t*)bytes, NULL) == -1) {
> + Size = 0;
> return Fail;
> + }
>
> uint16_t insn16 = (bytes[1] << 8) | bytes[0];
> DecodeStatus result = decodeThumbInstruction16(MI, insn16, Address, this);
> @@ -492,8 +497,10 @@
> }
>
> // We want to read exactly 4 bytes of data.
> - if (Region.readBytes(Address, 4, (uint8_t*)bytes, NULL) == -1)
> + if (Region.readBytes(Address, 4, (uint8_t*)bytes, NULL) == -1) {
> + Size = 0;
> return Fail;
> + }
>
> uint32_t insn32 = (bytes[3] << 8) |
> (bytes[2] << 0) |
> @@ -568,6 +575,7 @@
> }
> }
>
> + Size = 0;
> return Fail;
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list