From 6484dd46b8b0d6594b53f1c539dc0bd5d1179386 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 15 Apr 2010 03:32:19 +0000 Subject: fix a crash on "lli ex" or any other file whose name is exactly two characters long. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101336 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/lli/lli.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index 81c17cd8fc..affe6bb653 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -192,7 +192,8 @@ int main(int argc, char **argv, char * const *envp) { } else { // Otherwise, if there is a .bc suffix on the executable strip it off, it // might confuse the program. - if (InputFile.rfind(".bc") == InputFile.length() - 3) + if (InputFile.size() > 3 && + InputFile.rfind(".bc") == InputFile.length() - 3) InputFile.erase(InputFile.length() - 3); } -- cgit v1.2.3