summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/InlineAsm.cpp
diff options
context:
space:
mode:
authorKarl Schimpf <kschimpf@google.com>2015-09-03 15:41:34 +0000
committerKarl Schimpf <kschimpf@google.com>2015-09-03 15:41:34 +0000
commit388fd5ae2fff69406fb8b4a2f9eb2c764cc6c80d (patch)
tree2e21e0e03397f88b95b2e3c234caa7067a26fc52 /llvm/lib/IR/InlineAsm.cpp
parenta0daa7394e3c0b3811289684d9f4918a051794f1 (diff)
downloadbcm5719-llvm-388fd5ae2fff69406fb8b4a2f9eb2c764cc6c80d.tar.gz
bcm5719-llvm-388fd5ae2fff69406fb8b4a2f9eb2c764cc6c80d.zip
Fix SEGV in InlineAsm::ConstraintInfo::Parse.
Fixes bug 24646. Previous code was not checking if an index into a vector was valid, resulting in a SEGV. Fixed by assuming the construct can't be parsed when given this input. llvm-svn: 246773
Diffstat (limited to 'llvm/lib/IR/InlineAsm.cpp')
-rw-r--r--llvm/lib/IR/InlineAsm.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/IR/InlineAsm.cpp b/llvm/lib/IR/InlineAsm.cpp
index a181c5e834d..b7309b4f67b 100644
--- a/llvm/lib/IR/InlineAsm.cpp
+++ b/llvm/lib/IR/InlineAsm.cpp
@@ -159,6 +159,8 @@ bool InlineAsm::ConstraintInfo::Parse(StringRef Str,
// If Operand N already has a matching input, reject this. An output
// can't be constrained to the same value as multiple inputs.
if (isMultipleAlternative) {
+ if (multipleAlternativeIndex >= ConstraintsSoFar[N].multipleAlternatives.size())
+ return true;
InlineAsm::SubConstraintInfo &scInfo =
ConstraintsSoFar[N].multipleAlternatives[multipleAlternativeIndex];
if (scInfo.MatchingInput != -1)
@@ -290,4 +292,3 @@ bool InlineAsm::Verify(FunctionType *Ty, StringRef ConstStr) {
if (Ty->getNumParams() != NumInputs) return false;
return true;
}
-
OpenPOWER on IntegriCloud