This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Fix crash in decoding instruction with unknown floating point rounding mode
ClosedPublic

Authored by apazos on Sep 5 2018, 3:43 PM.

Details

Summary

Instead of crashing in printFRMArg, decode and warn about invalid instruction.

This bug was uncovered by a LLVM MC Disassembler Protocol Buffer Fuzzer for the RISC-V assembly language.

Diff Detail

Repository
rL LLVM

Event Timeline

apazos created this revision.Sep 5 2018, 3:43 PM
asb accepted this revision.Sep 6 2018, 7:24 AM

Looks good to me, thanks. Just one tiny comment inline.

As this is a disassembler-only test and only makes sense as a disassembler test it might be worth putting in test/MC/Disassembler/RISCV, and perhaps choosing a more descriptive name. e.g. invalid-fp-founding-mode.txt.

lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
120 ↗(On Diff #164117)

Can't this line be deleted as the case is fully covered.

This revision is now accepted and ready to land.Sep 6 2018, 7:24 AM
apazos updated this revision to Diff 164479.Sep 7 2018, 11:41 AM

Updated test case location and name.

This revision was automatically updated to reflect the committed changes.