mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[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
This commit is contained in:
parent
66b411671f
commit
773c96d05b
@ -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
|
||||
|
3
test/Assembler/empty-string.s
Normal file
3
test/Assembler/empty-string.s
Normal file
@ -0,0 +1,3 @@
|
||||
// REQUIRES: riscv-registered-target
|
||||
// RUN: not llvm-mc -triple riscv32-unknown-linux-gnu < %s 2>&1 | FileCheck %s
|
||||
"" # CHECK: error: unrecognized instruction mnemonic
|
Loading…
Reference in New Issue
Block a user