mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-27 06:54:30 +00:00
[BitcodeReader] Diagnose type mismatches with aliases
Bug found with AFL fuzz. llvm-svn: 238895
This commit is contained in:
parent
cc520bbd9a
commit
337bf6fd2c
@ -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…
x
Reference in New Issue
Block a user