mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-01 13:17:01 +00:00
[BitcodeReader] Make sure the type of the inserted value matches the type of the aggregate at those indices
Bug found with AFL-fuzz. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237628 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3644,6 +3644,9 @@ std::error_code BitcodeReader::ParseFunctionBody(Function *F) {
|
|||||||
CurTy = CurTy->subtypes()[0];
|
CurTy = CurTy->subtypes()[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CurTy != Val->getType())
|
||||||
|
return Error("Inserted value type doesn't match aggregate type");
|
||||||
|
|
||||||
I = InsertValueInst::Create(Agg, Val, INSERTVALIdx);
|
I = InsertValueInst::Create(Agg, Val, INSERTVALIdx);
|
||||||
InstructionList.push_back(I);
|
InstructionList.push_back(I);
|
||||||
break;
|
break;
|
||||||
|
BIN
test/Bitcode/Inputs/invalid-inserted-value-type-mismatch.bc
Normal file
BIN
test/Bitcode/Inputs/invalid-inserted-value-type-mismatch.bc
Normal file
Binary file not shown.
@@ -142,3 +142,8 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-load-ptr-type.bc 2>&1 | \
|
|||||||
RUN: FileCheck --check-prefix=BAD-LOAD-PTR-TYPE %s
|
RUN: FileCheck --check-prefix=BAD-LOAD-PTR-TYPE %s
|
||||||
|
|
||||||
BAD-LOAD-PTR-TYPE: Cannot load/store from pointer
|
BAD-LOAD-PTR-TYPE: Cannot load/store from pointer
|
||||||
|
|
||||||
|
RUN: not llvm-dis -disable-output %p/Inputs/invalid-inserted-value-type-mismatch.bc 2>&1 | \
|
||||||
|
RUN: FileCheck --check-prefix=INSERT-TYPE-MISMATCH %s
|
||||||
|
|
||||||
|
INSERT-TYPE-MISMATCH: Inserted value type doesn't match aggregate type
|
||||||
|
Reference in New Issue
Block a user