mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
[BitcodeReader] Diagnose type mismatches with aliases
Bug found with AFL fuzz. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238895 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1a2a0ee8a0
commit
a3a2cab504
@ -2065,9 +2065,12 @@ std::error_code BitcodeReader::ResolveGlobalAndAliasInits() {
|
||||
if (ValID >= ValueList.size()) {
|
||||
AliasInits.push_back(AliasInitWorklist.back());
|
||||
} else {
|
||||
if (Constant *C = dyn_cast_or_null<Constant>(ValueList[ValID]))
|
||||
AliasInitWorklist.back().first->setAliasee(C);
|
||||
else
|
||||
if (Constant *C = dyn_cast_or_null<Constant>(ValueList[ValID])) {
|
||||
GlobalAlias *Alias = AliasInitWorklist.back().first;
|
||||
if (C->getType() != Alias->getType())
|
||||
return Error("Alias and aliasee types don't match");
|
||||
Alias->setAliasee(C);
|
||||
} else
|
||||
return Error("Expected a constant");
|
||||
}
|
||||
AliasInitWorklist.pop_back();
|
||||
|
BIN
test/Bitcode/Inputs/invalid-alias-type-mismatch.bc
Normal file
BIN
test/Bitcode/Inputs/invalid-alias-type-mismatch.bc
Normal file
Binary file not shown.
@ -197,3 +197,8 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-vector-length.bc 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=VECTOR-LENGTH %s
|
||||
|
||||
VECTOR-LENGTH: Invalid vector length
|
||||
|
||||
RUN: not llvm-dis -disable-output %p/Inputs/invalid-alias-type-mismatch.bc 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=ALIAS-TYPE-MISMATCH %s
|
||||
|
||||
ALIAS-TYPE-MISMATCH: Alias and aliasee types don't match
|
||||
|
Loading…
Reference in New Issue
Block a user