diff options
author | Filipe Cabecinhas <me@filcab.net> | 2015-04-30 00:52:42 +0000 |
---|---|---|
committer | Filipe Cabecinhas <me@filcab.net> | 2015-04-30 00:52:42 +0000 |
commit | bad0779f6310af38570f4fcfc68ea876d5e4dca7 (patch) | |
tree | 39e5d606a7417e837fe513a953bbaa77c6a78e8c /llvm/lib | |
parent | 34948e5e22079597714618a724feb70eeaba2609 (diff) | |
download | bcm5719-llvm-bad0779f6310af38570f4fcfc68ea876d5e4dca7.tar.gz bcm5719-llvm-bad0779f6310af38570f4fcfc68ea876d5e4dca7.zip |
Make sure we don't resize(0) when we get a fwdref with Idx == UINT_MAX
Make it an error instead.
Bug found with AFL fuzz.
llvm-svn: 236190
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index f49a53805c9..7778125e2d4 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -790,6 +790,10 @@ Constant *BitcodeReaderValueList::getConstantFwdRef(unsigned Idx, } Value *BitcodeReaderValueList::getValueFwdRef(unsigned Idx, Type *Ty) { + // Bail out for a clearly invalid value. This would make us call resize(0) + if (Idx == UINT_MAX) + return nullptr; + if (Idx >= size()) resize(Idx + 1); |