summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2015-03-02 05:25:06 +0000
committerOwen Anderson <resistor@mac.com>2015-03-02 05:25:06 +0000
commit91bdf0765000295c18ba87b244bab3c412d07310 (patch)
treec1e4850f5f7cd07157387d96aba85dc31aa9c2f4 /llvm/lib/AsmParser/LLParser.cpp
parent7797c726b9a864372553de4b640c540b1dae8251 (diff)
downloadbcm5719-llvm-91bdf0765000295c18ba87b244bab3c412d07310.tar.gz
bcm5719-llvm-91bdf0765000295c18ba87b244bab3c412d07310.zip
Fix a crash in the LL parser where it failed to validate that the pointer operand of a GEP was valid.
This manifested as an assertion failure in +Asserts builds, and a hard crash in -Asserts builds. Found by fuzzing the LL parser. llvm-svn: 230934
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 40563b536bd..d50da69529c 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -5458,6 +5458,8 @@ int LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) {
return true;
Type *PtrTy = Ptr->getType();
+ if (!isa<SequentialType>(PtrTy))
+ return Error(Loc, "pointer type is not valid");
if (VectorType *VT = dyn_cast<VectorType>(PtrTy))
PtrTy = VT->getElementType();
if (Ty != cast<SequentialType>(PtrTy)->getElementType())
OpenPOWER on IntegriCloud