[llvm-commits] [llvm] r101336 - /llvm/trunk/tools/lli/lli.cpp

Chris Lattner sabre at nondot.org
Wed Apr 14 20:32:19 PDT 2010


Author: lattner
Date: Wed Apr 14 22:32:19 2010
New Revision: 101336

URL: http://llvm.org/viewvc/llvm-project?rev=101336&view=rev
Log:
fix a crash on "lli ex" or any other file whose name is exactly two
characters long.

Modified:
    llvm/trunk/tools/lli/lli.cpp

Modified: llvm/trunk/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=101336&r1=101335&r2=101336&view=diff
==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Wed Apr 14 22:32:19 2010
@@ -192,7 +192,8 @@
   } 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);
   }
 





More information about the llvm-commits mailing list