mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
[BitcodeReader] Change an assert to a call to a call to Error()
It's reachable from user input. Bug found with AFL fuzz. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238633 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dbf84c95fe
commit
3b821159da
@ -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();
|
||||
|
BIN
test/Bitcode/Inputs/invalid-metadata-not-followed-named-node.bc
Normal file
BIN
test/Bitcode/Inputs/invalid-metadata-not-followed-named-node.bc
Normal file
Binary file not shown.
@ -187,3 +187,8 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-array-operand-encoding.bc 2>
|
||||
RUN: FileCheck --check-prefix=ARRAY-OP-ENC %s
|
||||
|
||||
ARRAY-OP-ENC: Array element type has to be an encoding of a type
|
||||
|
||||
RUN: not llvm-dis -disable-output %p/Inputs/invalid-metadata-not-followed-named-node.bc 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=META-NOT-FOLLOWED-BY-NAMED-META %s
|
||||
|
||||
META-NOT-FOLLOWED-BY-NAMED-META: METADATA_NAME not followed by METADATA_NAMED_NODE
|
||||
|
Loading…
Reference in New Issue
Block a user