mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Check bit widths before trying to get a type.
Added a test case for it. Also added run lines for the test case in r227566. Bugs found with afl-fuzz git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227589 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -950,12 +950,17 @@ std::error_code BitcodeReader::ParseTypeTableBody() {
|
||||
case bitc::TYPE_CODE_X86_MMX: // X86_MMX
|
||||
ResultTy = Type::getX86_MMXTy(Context);
|
||||
break;
|
||||
case bitc::TYPE_CODE_INTEGER: // INTEGER: [width]
|
||||
case bitc::TYPE_CODE_INTEGER: { // INTEGER: [width]
|
||||
if (Record.size() < 1)
|
||||
return Error("Invalid record");
|
||||
|
||||
ResultTy = IntegerType::get(Context, Record[0]);
|
||||
uint64_t NumBits = Record[0];
|
||||
if (NumBits < IntegerType::MIN_INT_BITS ||
|
||||
NumBits > IntegerType::MAX_INT_BITS)
|
||||
return Error("Bitwidth for integer type out of range");
|
||||
ResultTy = IntegerType::get(Context, NumBits);
|
||||
break;
|
||||
}
|
||||
case bitc::TYPE_CODE_POINTER: { // POINTER: [pointee type] or
|
||||
// [pointee type, address space]
|
||||
if (Record.size() < 1)
|
||||
|
Reference in New Issue
Block a user