aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AsmParser/llvmAsmParser.cpp.cvs6
-rw-r--r--lib/AsmParser/llvmAsmParser.y.cvs6
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/AsmParser/llvmAsmParser.cpp.cvs b/lib/AsmParser/llvmAsmParser.cpp.cvs
index d031c3b35f..c8f7599b80 100644
--- a/lib/AsmParser/llvmAsmParser.cpp.cvs
+++ b/lib/AsmParser/llvmAsmParser.cpp.cvs
@@ -5488,9 +5488,9 @@ yyreduce:
// Check for call to invalid intrinsic to avoid crashing later.
if (Function *theF = dyn_cast<Function>(V)) {
- if (theF->hasName() &&
- 0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5) &&
- !theF->getIntrinsicID(true))
+ if (theF->hasName() && (strlen(theF->getValueName()->getKeyData()) >= 5)&&
+ (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
+ !theF->getIntrinsicID(true))
GEN_ERROR("Call to invalid LLVM intrinsic function '" +
theF->getName() + "'");
}
diff --git a/lib/AsmParser/llvmAsmParser.y.cvs b/lib/AsmParser/llvmAsmParser.y.cvs
index 5544008542..263ef4c6ec 100644
--- a/lib/AsmParser/llvmAsmParser.y.cvs
+++ b/lib/AsmParser/llvmAsmParser.y.cvs
@@ -2823,9 +2823,9 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
// Check for call to invalid intrinsic to avoid crashing later.
if (Function *theF = dyn_cast<Function>(V)) {
- if (theF->hasName() &&
- 0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5) &&
- !theF->getIntrinsicID(true))
+ if (theF->hasName() && (strlen(theF->getValueName()->getKeyData()) >= 5)&&
+ (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
+ !theF->getIntrinsicID(true))
GEN_ERROR("Call to invalid LLVM intrinsic function '" +
theF->getName() + "'");
}