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

Unified Diff: src/sksl/SkSLParser.cpp

Issue 2420163002: another SkSL crash fix (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/SkSLParser.cpp
diff --git a/src/sksl/SkSLParser.cpp b/src/sksl/SkSLParser.cpp
index d011d46947066d2e55a3485d4203a870f5301e2e..2699d9c113d076dee0844196220ed0bff1734806 100644
--- a/src/sksl/SkSLParser.cpp
+++ b/src/sksl/SkSLParser.cpp
@@ -331,8 +331,9 @@ std::unique_ptr<ASTType> 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) + "]";
« 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