Bug found with afl-fuzz.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252048
91177308-0d34-0410-b5e6-
96231b3b80d8
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)) {
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