mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
Fix a use after free on invalid input.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193737 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8f4397799f
commit
cc8c673e61
@ -623,11 +623,7 @@ bool BitcodeReader::ParseAttrKind(uint64_t Code, Attribute::AttrKind *Kind) {
|
|||||||
*Kind = Attribute::ZExt;
|
*Kind = Attribute::ZExt;
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
std::string Buf;
|
return Error("Unknown attribute kind");
|
||||||
raw_string_ostream fmt(Buf);
|
|
||||||
fmt << "Unknown attribute kind (" << Code << ")";
|
|
||||||
fmt.flush();
|
|
||||||
return Error(Buf.c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
test/Bitcode/invalid.ll
Normal file
7
test/Bitcode/invalid.ll
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
; RUN: not llvm-dis < %s.bc 2>&1 | FileCheck %s
|
||||||
|
|
||||||
|
; CHECK: llvm-dis: Unknown attribute kind
|
||||||
|
|
||||||
|
; invalid.ll.bc has an invalid attribute number.
|
||||||
|
; The test checks that LLVM reports the error and doesn't access freed memory
|
||||||
|
; in doing so.
|
BIN
test/Bitcode/invalid.ll.bc
Normal file
BIN
test/Bitcode/invalid.ll.bc
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user