fixed an assertion error with unspecified sksl array sizes
Bug: oss-fuzz:15329 Change-Id: I994e58e794e4c0ee97a59ff83f295dc981ba5dba Reviewed-on: https://skia-review.googlesource.com/c/skia/+/240276 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
f57b7cb8f0
commit
66d8006c2b
@ -303,11 +303,12 @@ std::unique_ptr<VarDeclarations> IRGenerator::convertVarDeclarations(const ASTNo
|
||||
count = ((IntLiteral&) *size).fValue;
|
||||
if (count <= 0) {
|
||||
fErrors.error(size->fOffset, "array size must be positive");
|
||||
return nullptr;
|
||||
}
|
||||
name += "[" + to_string(count) + "]";
|
||||
} else {
|
||||
count = -1;
|
||||
name += "[]";
|
||||
fErrors.error(size->fOffset, "array size must be specified");
|
||||
return nullptr;
|
||||
}
|
||||
type = (Type*) fSymbolTable->takeOwnership(
|
||||
std::unique_ptr<Symbol>(new Type(name,
|
||||
@ -965,11 +966,12 @@ std::unique_ptr<InterfaceBlock> IRGenerator::convertInterfaceBlock(const ASTNode
|
||||
count = ((IntLiteral&) *converted).fValue;
|
||||
if (count <= 0) {
|
||||
fErrors.error(converted->fOffset, "array size must be positive");
|
||||
return nullptr;
|
||||
}
|
||||
name += "[" + to_string(count) + "]";
|
||||
} else {
|
||||
count = -1;
|
||||
name += "[]";
|
||||
fErrors.error(intf.fOffset, "array size must be specified");
|
||||
return nullptr;
|
||||
}
|
||||
type = (Type*) symbols->takeOwnership(std::unique_ptr<Symbol>(
|
||||
new Type(name,
|
||||
@ -978,12 +980,8 @@ std::unique_ptr<InterfaceBlock> IRGenerator::convertInterfaceBlock(const ASTNode
|
||||
(int) count)));
|
||||
sizes.push_back(std::move(converted));
|
||||
} else {
|
||||
type = (Type*) symbols->takeOwnership(std::unique_ptr<Symbol>(
|
||||
new Type(type->name() + "[]",
|
||||
Type::kArray_Kind,
|
||||
*type,
|
||||
-1)));
|
||||
sizes.push_back(nullptr);
|
||||
fErrors.error(intf.fOffset, "array size must be specified");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
Variable* var = (Variable*) old->takeOwnership(std::unique_ptr<Symbol>(
|
||||
|
Loading…
Reference in New Issue
Block a user