1
0
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:
Ana Pazos 2018-08-25 01:34:32 +00:00
parent 66b411671f
commit 773c96d05b
2 changed files with 4 additions and 1 deletions

View File

@ -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

View 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