diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-05-22 14:57:42 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-05-22 14:57:42 +0000 |
commit | 431c73bc336b1d68171bc719af8a532078869c0f (patch) | |
tree | 3b71c8a3436e574a57b76c0a3be318add7efc3b1 /lib/Target/MBlaze | |
parent | dbd8eb26ce1e7de9b69f5c46f45ba011a706c9b9 (diff) | |
download | external_llvm-431c73bc336b1d68171bc719af8a532078869c0f.zip external_llvm-431c73bc336b1d68171bc719af8a532078869c0f.tar.gz external_llvm-431c73bc336b1d68171bc719af8a532078869c0f.tar.bz2 |
Check that a function starts with llvm. before using GET_FUNCTION_RECOGNIZER.
Fixes a use of uninitialized memory found by asan and valgind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182480 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/MBlaze')
-rw-r--r-- | lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp b/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp index 8d262a0..0d3f7d8 100644 --- a/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp +++ b/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp @@ -58,9 +58,8 @@ std::string MBlazeIntrinsicInfo::getName(unsigned IntrID, Type **Tys, unsigned MBlazeIntrinsicInfo:: lookupName(const char *Name, unsigned Len) const { - if (Len < 5 || Name[4] != '.' || Name[0] != 'l' || Name[1] != 'l' - || Name[2] != 'v' || Name[3] != 'm') - return 0; // All intrinsics start with 'llvm.' + if (!StringRef(Name, Len).startswith("llvm.")) + return 0; // All intrinsics start with 'llvm.' #define GET_FUNCTION_RECOGNIZER #include "MBlazeGenIntrinsics.inc" |