Page MenuHomePhabricator

[Mips][Disassembler][R6] Disassembler crashes on compact jump instructions for r6
ClosedPublic

Authored by vmedic on Dec 31 2014, 2:27 AM.

Details

Summary

When disassembler meets compact jump instructions for r6 it crashes as the access to operands array is out of range. This patch adds dedicated decoder method that properly handles decoding of these instructions.

Diff Detail

Event Timeline

vmedic updated this revision to Diff 17743.Dec 31 2014, 2:27 AM
vmedic retitled this revision from to [Mips][Disassembler][R6] Disassembler crashes on compact jump instructions for r6.
vmedic updated this object.
vmedic edited the test plan for this revision. (Show Details)
vmedic added reviewers: dsanders, sstankovic.
vmedic added a subscriber: Unknown Object (MLST).
dsanders edited edge metadata.Jan 13 2015, 5:45 AM

Please include the full context as per the instructions at http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface.

lib/Target/Mips/Disassembler/MipsDisassembler.cpp
415–416 ↗(On Diff #17743)

Nit: indentation

1771–1773 ↗(On Diff #17743)

Nit: indentation

lib/Target/Mips/Mips32r6InstrInfo.td
381–382

I'm not sure this one needs a DecoderMethod since there's nothing particularly special about the operands and the new DecodeCompactJump() isn't doing anything tricky. In particular, there aren't any ins/outs that have multiple corresponding MCOperands. It seems like the problem is just innappropriate use of DecodeSimm16.

Could you try deleting this line and see if that fixes the problem too?

test/MC/Disassembler/Mips/mips64r6/valid-mips64r6.txt
168

Nit: delete extra blank line

vmedic updated this revision to Diff 18496.Jan 21 2015, 3:35 AM
vmedic edited edge metadata.

Removed dedicated decoder method as suggested.

vmedic updated this revision to Diff 18497.Jan 21 2015, 3:38 AM

Commented line removed.

dsanders accepted this revision.Jan 22 2015, 3:34 AM
dsanders edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jan 22 2015, 3:34 AM

Oops, I noticed something after clicking submit. LGTM with a whitespace nit. You gained some additional blank-lines at the end of some of the tests.

vmedic closed this revision.Jan 26 2015, 2:48 AM

Trailing spaces removed. Committed revision 227084.