summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorFilipe Cabecinhas <me@filcab.net>2015-04-28 20:18:47 +0000
committerFilipe Cabecinhas <me@filcab.net>2015-04-28 20:18:47 +0000
commitb435d0f4395448620e3e15411e635c102d915a2e (patch)
tree08482cbf75a3e28c8e176e0aacbe1e22f8238bd7 /llvm/lib
parente3ff9305cd91b217f8a7f08ba55c60f542021882 (diff)
downloadbcm5719-llvm-b435d0f4395448620e3e15411e635c102d915a2e.tar.gz
bcm5719-llvm-b435d0f4395448620e3e15411e635c102d915a2e.zip
Relax an assert when there's a type mismatch in forward references
Summary: We don't seem to need to assert here, since this function's callers expect to get a nullptr on error. This way we don't assert on user input. Bug found with AFL fuzz. Reviewers: rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9308 llvm-svn: 236027
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 35e98c01760..6656478754e 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -794,7 +794,9 @@ Value *BitcodeReaderValueList::getValueFwdRef(unsigned Idx, Type *Ty) {
resize(Idx + 1);
if (Value *V = ValuePtrs[Idx]) {
- assert((!Ty || Ty == V->getType()) && "Type mismatch in value table!");
+ // If the types don't match, it's invalid.
+ if (Ty && Ty != V->getType())
+ return nullptr;
return V;
}
OpenPOWER on IntegriCloud