mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
Error out when faced with value names containing '\0'
Bug found with afl-fuzz. llvm-svn: 252048
This commit is contained in:
parent
52c1d43c18
commit
e215a5f192
@ -1749,7 +1749,10 @@ ErrorOr<Value *> BitcodeReader::recordValue(SmallVectorImpl<uint64_t> &Record,
|
||||
return error("Invalid record");
|
||||
Value *V = ValueList[ValueID];
|
||||
|
||||
V->setName(StringRef(ValueName.data(), ValueName.size()));
|
||||
StringRef NameStr(ValueName.data(), ValueName.size());
|
||||
if (NameStr.find_first_of(0) != StringRef::npos)
|
||||
return error("Invalid value name");
|
||||
V->setName(NameStr);
|
||||
auto *GO = dyn_cast<GlobalObject>(V);
|
||||
if (GO) {
|
||||
if (GO->getComdat() == reinterpret_cast<Comdat *>(1)) {
|
||||
|
BIN
test/Bitcode/Inputs/invalid-name-with-0-byte.bc
Normal file
BIN
test/Bitcode/Inputs/invalid-name-with-0-byte.bc
Normal file
Binary file not shown.
@ -212,3 +212,8 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-no-function-block.bc 2>&1 |
|
||||
RUN: FileCheck --check-prefix=NO-FUNCTION-BLOCK %s
|
||||
|
||||
NO-FUNCTION-BLOCK: Trying to materialize functions before seeing function blocks
|
||||
|
||||
RUN: not llvm-dis -disable-output %p/Inputs/invalid-name-with-0-byte.bc 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=NAME-WITH-0 %s
|
||||
|
||||
NAME-WITH-0: Invalid value name
|
||||
|
Loading…
Reference in New Issue
Block a user