[llvm] r246773 - Fix SEGV in InlineAsm::ConstraintInfo::Parse.
Karl Schimpf via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 3 08:41:35 PDT 2015
Author: kschimpf
Date: Thu Sep 3 10:41:34 2015
New Revision: 246773
URL: http://llvm.org/viewvc/llvm-project?rev=246773&view=rev
Log:
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.
Modified:
llvm/trunk/lib/IR/InlineAsm.cpp
Modified: llvm/trunk/lib/IR/InlineAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/InlineAsm.cpp?rev=246773&r1=246772&r2=246773&view=diff
==============================================================================
--- llvm/trunk/lib/IR/InlineAsm.cpp (original)
+++ llvm/trunk/lib/IR/InlineAsm.cpp Thu Sep 3 10:41:34 2015
@@ -159,6 +159,8 @@ bool InlineAsm::ConstraintInfo::Parse(St
// 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,
if (Ty->getNumParams() != NumInputs) return false;
return true;
}
-
More information about the llvm-commits
mailing list