summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader
diff options
context:
space:
mode:
authorFilipe Cabecinhas <me@filcab.net>2015-04-30 01:13:31 +0000
committerFilipe Cabecinhas <me@filcab.net>2015-04-30 01:13:31 +0000
commit9a19e56306a4fd2a08e89d51fad3fb6abb8a3c64 (patch)
tree374fe16c74fff3f85b43bc5eca8d021836d6a52c /llvm/lib/Bitcode/Reader
parent4b828d35fdf85c384170f930dcbf3013d22f1eb2 (diff)
downloadbcm5719-llvm-9a19e56306a4fd2a08e89d51fad3fb6abb8a3c64.tar.gz
bcm5719-llvm-9a19e56306a4fd2a08e89d51fad3fb6abb8a3c64.zip
Make sure Op->getType() is a PointerType before we cast<> it.
Bug found with AFL fuzz. llvm-svn: 236193
Diffstat (limited to 'llvm/lib/Bitcode/Reader')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 7778125e2d4..456df6dab8e 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -4065,6 +4065,8 @@ std::error_code BitcodeReader::ParseFunctionBody(Function *F) {
Type *Ty = nullptr;
if (OpNum + 3 == Record.size())
Ty = getTypeByID(Record[OpNum++]);
+ if (!isa<PointerType>(Op->getType()))
+ return Error("Load operand is not a pointer type");
if (!Ty)
Ty = cast<PointerType>(Op->getType())->getElementType();
else if (Ty != cast<PointerType>(Op->getType())->getElementType())
OpenPOWER on IntegriCloud