summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser/AsmParser.cpp
diff options
context:
space:
mode:
authorAna Pazos <apazos@codeaurora.org>2018-08-25 01:34:32 +0000
committerAna Pazos <apazos@codeaurora.org>2018-08-25 01:34:32 +0000
commit353f67a741daa97e94bd402f6394c6d89fd8a987 (patch)
tree6169730fa1f4284457b6b9d5f9e92656e5547d92 /llvm/lib/MC/MCParser/AsmParser.cpp
parenta2e0c2462a5ed4ddabab03dfddb97efc54682bde (diff)
downloadbcm5719-llvm-353f67a741daa97e94bd402f6394c6d89fd8a987.tar.gz
bcm5719-llvm-353f67a741daa97e94bd402f6394c6d89fd8a987.zip
[MC, RISCV] Fixed StringRef Assertion `Index < Length && "Invalid index!"'
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. Reviewers: rnk Reviewed By: rnk Subscribers: rnk, niravd, pcc, peter.smith, asb, grosbach, llvm-commits, bcain, kito-cheng, shiva0217, rogfer01, PkmX Differential Revision: https://reviews.llvm.org/D50808 llvm-svn: 340678
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 501a1cccf60..0a4706ed104 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -1842,7 +1842,7 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
// Otherwise, we have a normal instruction or directive.
// Directives start with "."
- if (IDVal[0] == '.' && IDVal != ".") {
+ if (IDVal.startswith(".") && IDVal != ".") {
// There are several entities interested in parsing directives:
//
// 1. The target-specific assembly parser. Some directives are target
OpenPOWER on IntegriCloud