From: ethannicholas Date: Fri, 14 Oct 2016 19:14:46 +0000 (-0700) Subject: another SkSL crash fix X-Git-Tag: submit/tizen/20180928.044319~73^2~599 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd4645b3051ab7944e5609b6d5ce9774d011bfbd;p=platform%2Fupstream%2FlibSkiaSharp.git another SkSL crash fix BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2420163002 Review-Url: https://codereview.chromium.org/2420163002 --- diff --git a/src/sksl/SkSLParser.cpp b/src/sksl/SkSLParser.cpp index d011d46947..2699d9c113 100644 --- a/src/sksl/SkSLParser.cpp +++ b/src/sksl/SkSLParser.cpp @@ -331,8 +331,9 @@ std::unique_ptr Parser::structDeclaration() { for (const auto& var : decl->fVars) { auto type = (const Type*) fTypes[decl->fType->fName]; for (int i = (int) var.fSizes.size() - 1; i >= 0; i--) { - if (var.fSizes[i]->fKind != ASTExpression::kInt_Kind) { + if (!var.fSizes[i] || var.fSizes[i]->fKind != ASTExpression::kInt_Kind) { this->error(decl->fPosition, "array size in struct field must be a constant"); + return nullptr; } uint64_t columns = ((ASTIntLiteral&) *var.fSizes[i]).fValue; std::string name = type->name() + "[" + to_string(columns) + "]";