more SkSL fuzzer crash fixes
authorethannicholas <ethannicholas@google.com>
Fri, 14 Oct 2016 16:56:33 +0000 (09:56 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 14 Oct 2016 16:56:33 +0000 (09:56 -0700)
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2414413002

Review-Url: https://codereview.chromium.org/2414413002

src/sksl/SkSLIRGenerator.cpp

index 9a42379065e05bb1ecc355fc35361471dae1b78d..b93cbfbe9931495765f20b2e8f86e614c59c0980 100644 (file)
@@ -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 "