1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Fix SEGV in InlineAsm::ConstraintInfo::Parse.

Summary:
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.

Reformat and add test.

Differential Revision: http://reviews.llvm.org/D12539

llvm-svn: 246774
This commit is contained in:
Karl Schimpf 2015-09-03 15:41:37 +00:00
parent 2d3030ebd1
commit 09e7a2e684
2 changed files with 2 additions and 1 deletions

View File

@ -159,7 +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())
if (multipleAlternativeIndex >=
ConstraintsSoFar[N].multipleAlternatives.size())
return true;
InlineAsm::SubConstraintInfo &scInfo =
ConstraintsSoFar[N].multipleAlternatives[multipleAlternativeIndex];

Binary file not shown.