This is an archive of the discontinued LLVM Phabricator instance.

[MC, RISCV] Fixed StringRef Assertion `Index < Length && "Invalid index!"'
ClosedPublic

Authored by apazos on Aug 15 2018, 1:48 PM.

Details

Summary

Handle the case IDVal is an empty string.

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

Diff Detail

Event Timeline

apazos created this revision.Aug 15 2018, 1:48 PM
bcain added a subscriber: bcain.Aug 15 2018, 3:01 PM
asb added a subscriber: asb.Aug 23 2018, 7:19 AM
asb added inline comments.Aug 23 2018, 7:21 AM
test/Assembler/empty-string.s
1

This test shouldn't actually require asserts should it?

apazos updated this revision to Diff 162516.Aug 24 2018, 5:20 PM

Thanks Alex for reviewing. Adding some more reviewers who might +1 before I merge

rnk accepted this revision.Aug 24 2018, 5:33 PM

lgtm

lib/MC/MCParser/AsmParser.cpp
1844

I'd probably spell it IDVal.startswith(".") for readability.

This revision is now accepted and ready to land.Aug 24 2018, 5:33 PM
apazos added inline comments.Aug 24 2018, 6:04 PM
lib/MC/MCParser/AsmParser.cpp
1844

good suggestion, will update the patch and merge. Thanks, Reid.

apazos updated this revision to Diff 162526.Aug 24 2018, 6:20 PM
This revision was automatically updated to reflect the committed changes.