[BitCode] Diagnose GEPs with no indices

llvm-svn: 271849
This commit is contained in:
Filipe Cabecinhas
2016-06-05 18:43:26 +00:00
parent 2849b48fea
commit fc2a3c98e9
3 changed files with 8 additions and 0 deletions

View File

@@ -3090,6 +3090,9 @@ std::error_code BitcodeReader::parseConstants() {
return error("Explicit gep operator type does not match pointee type "
"of pointer operand");
if (Elts.size() < 1)
return error("Invalid gep with no operands");
ArrayRef<Constant *> Indices(Elts.begin() + 1, Elts.end());
V = ConstantExpr::getGetElementPtr(PointeeType, Elts[0], Indices,
BitCode ==