Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(805)

Unified Diff: src/sksl/SkSLIRGenerator.cpp

Issue 2414413002: more SkSL fuzzer crash fixes (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/sksl/SkSLIRGenerator.cpp
diff --git a/src/sksl/SkSLIRGenerator.cpp b/src/sksl/SkSLIRGenerator.cpp
index 6307087edd9d4f97233d1ea16f20aed848dc5b04..b93cbfbe9931495765f20b2e8f86e614c59c0980 100644
--- a/src/sksl/SkSLIRGenerator.cpp
+++ b/src/sksl/SkSLIRGenerator.cpp
@@ -525,6 +525,9 @@ std::unique_ptr<InterfaceBlock> IRGenerator::convertInterfaceBlock(const ASTInte
std::unique_ptr<VarDeclarations> decl = this->convertVarDeclarations(
*intf.fDeclarations[i],
Variable::kGlobal_Storage);
+ if (!decl) {
+ return nullptr;
+ }
for (const auto& var : decl->fVars) {
fields.push_back(Type::Field(var.fVar->fModifiers, var.fVar->fName,
&var.fVar->fType));
@@ -1024,11 +1027,17 @@ std::unique_ptr<Expression> IRGenerator::convertConstructor(
int rows = args[i]->fType.rows();
args[i] = this->coerce(std::move(args[i]),
type.componentType().toCompound(fContext, columns, rows));
+ if (!args[i]) {
+ return nullptr;
+ }
actual += args[i]->fType.rows() * args[i]->fType.columns();
} else if (args[i]->fType.kind() == Type::kScalar_Kind) {
actual += 1;
if (type.kind() != Type::kScalar_Kind) {
args[i] = this->coerce(std::move(args[i]), type.componentType());
+ if (!args[i]) {
+ return nullptr;
+ }
}
} else {
fErrors.error(position, "'" + args[i]->fType.description() + "' is not a valid "
@@ -1228,6 +1237,7 @@ std::unique_ptr<Expression> IRGenerator::convertSuffixExpression(
*newType));
} else {
fErrors.error(expression.fPosition, "'[]' must follow a type name");
+ return nullptr;
}
}
case ASTSuffix::kCall_Kind: {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698