diff options
| author | Karl Schimpf <kschimpf@google.com> | 2015-09-03 15:41:37 +0000 |
|---|---|---|
| committer | Karl Schimpf <kschimpf@google.com> | 2015-09-03 15:41:37 +0000 |
| commit | f04a5d597886696f085c6fdcae68c14cc571b3bf (patch) | |
| tree | 7cc58063009deacdd67627a636c8172a53121e0f /llvm/lib | |
| parent | 388fd5ae2fff69406fb8b4a2f9eb2c764cc6c80d (diff) | |
| download | bcm5719-llvm-f04a5d597886696f085c6fdcae68c14cc571b3bf.tar.gz bcm5719-llvm-f04a5d597886696f085c6fdcae68c14cc571b3bf.zip | |
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
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/InlineAsm.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/IR/InlineAsm.cpp b/llvm/lib/IR/InlineAsm.cpp index b7309b4f67b..15d3b830b8f 100644 --- a/llvm/lib/IR/InlineAsm.cpp +++ b/llvm/lib/IR/InlineAsm.cpp @@ -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]; |

