mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-04 09:37:20 +00:00
Check that we have a valid PointerType element type before calling get()
Same as r236073 but for PointerType. Bug found with AFL fuzz. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236079 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5c9b6dbb73
commit
99ebc9e004
@ -1360,7 +1360,8 @@ std::error_code BitcodeReader::ParseTypeTableBody() {
|
||||
if (Record.size() == 2)
|
||||
AddressSpace = Record[1];
|
||||
ResultTy = getTypeByID(Record[0]);
|
||||
if (!ResultTy)
|
||||
if (!ResultTy ||
|
||||
!PointerType::isValidElementType(ResultTy))
|
||||
return Error("Invalid type");
|
||||
ResultTy = PointerType::get(ResultTy, AddressSpace);
|
||||
break;
|
||||
|
BIN
test/Bitcode/Inputs/invalid-pointer-element-type.bc
Normal file
BIN
test/Bitcode/Inputs/invalid-pointer-element-type.bc
Normal file
Binary file not shown.
@ -103,6 +103,8 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-array-element-type.bc 2>&1 |
|
||||
RUN: FileCheck --check-prefix=ELEMENT-TYPE %s
|
||||
RUN: not llvm-dis -disable-output %p/Inputs/invalid-vector-element-type.bc 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=ELEMENT-TYPE %s
|
||||
RUN: not llvm-dis -disable-output %p/Inputs/invalid-pointer-element-type.bc 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=ELEMENT-TYPE %s
|
||||
|
||||
ELEMENT-TYPE: Invalid type
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user