This is an archive of the discontinued LLVM Phabricator instance.

[inlineasm] Fix crash when number of matched input constraint operands overflows signed char
ClosedPublic

Authored by dfukalov on Oct 20 2017, 8:29 AM.

Details

Summary

In a case when number of output constraint operands that has matched input operands
doesn't fit to signed char, TargetLowering::ParseConstraints() can try to access
ConstraintOperands (that is std::vector) with negative index.

Diff Detail

Event Timeline

dfukalov created this revision.Oct 20 2017, 8:29 AM
rampitec added inline comments.Oct 20 2017, 9:39 AM
test/CodeGen/AMDGPU/InlineAsmCrash.ll
2

Please add -verify-machineinstrs

dfukalov updated this revision to Diff 119770.Oct 21 2017, 2:28 PM
dfukalov marked an inline comment as done.

Please post this patch with full context.

dfukalov updated this revision to Diff 119866.Oct 23 2017, 9:18 AM

Sorry for incomplete diff

dfukalov updated this revision to Diff 119869.Oct 23 2017, 9:19 AM
arsenm accepted this revision.Oct 23 2017, 9:37 AM

LGTM with the minor cleanups

lib/IR/InlineAsm.cpp
166

Spaces around >=

174

Ditto

test/CodeGen/AMDGPU/InlineAsmCrash.ll
1

This should check something in the output

This revision is now accepted and ready to land.Oct 23 2017, 9:37 AM
dfukalov closed this revision.Oct 25 2017, 6:31 AM