summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
authorFilipe Cabecinhas <me@filcab.net>2015-05-30 00:17:20 +0000
committerFilipe Cabecinhas <me@filcab.net>2015-05-30 00:17:20 +0000
commit14e686774d8807265d921ff0c2d1e8ac8e1ab072 (patch)
tree588968e09e07d5037e0c3244cd81903616c8d896 /llvm/lib/Bitcode
parentb82e33106bdfcace762c441f628f1125ae6a0957 (diff)
downloadbcm5719-llvm-14e686774d8807265d921ff0c2d1e8ac8e1ab072.tar.gz
bcm5719-llvm-14e686774d8807265d921ff0c2d1e8ac8e1ab072.zip
[BitcodeReader] Change an assert to a call to a call to Error()
It's reachable from user input. Bug found with AFL fuzz. llvm-svn: 238633
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 441a4c76344..4044ac80f20 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1634,9 +1634,9 @@ std::error_code BitcodeReader::ParseMetadata() {
Record.clear();
Code = Stream.ReadCode();
- // METADATA_NAME is always followed by METADATA_NAMED_NODE.
unsigned NextBitCode = Stream.readRecord(Code, Record);
- assert(NextBitCode == bitc::METADATA_NAMED_NODE); (void)NextBitCode;
+ if (NextBitCode != bitc::METADATA_NAMED_NODE)
+ return Error("METADATA_NAME not followed by METADATA_NAMED_NODE");
// Read named metadata elements.
unsigned Size = Record.size();
OpenPOWER on IntegriCloud