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

Unified Diff: src/sksl/SkSLParser.cpp

Issue 2413423003: fix skslc crashes uncovered by fuzz testing (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 | « src/sksl/SkSLIRGenerator.cpp ('k') | 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 9e3e84784bfbc937d408d8a7b341e43c86fa50a8..d011d46947066d2e55a3485d4203a870f5301e2e 100644
--- a/src/sksl/SkSLParser.cpp
+++ b/src/sksl/SkSLParser.cpp
@@ -808,17 +808,26 @@ std::unique_ptr<ASTForStatement> Parser::forStatement() {
case Token::SEMICOLON:
this->nextToken();
break;
- case Token::CONST:
+ case Token::CONST: {
+ std::unique_ptr<ASTVarDeclarations> vd = this->varDeclarations();
+ if (!vd) {
+ return nullptr;
+ }
initializer = std::unique_ptr<ASTStatement>(new ASTVarDeclarationStatement(
- this->varDeclarations()));
+ std::move(vd)));
break;
- case Token::IDENTIFIER:
+ }
+ case Token::IDENTIFIER: {
if (this->isType(nextToken.fText)) {
+ std::unique_ptr<ASTVarDeclarations> vd = this->varDeclarations();
+ if (!vd) {
+ return nullptr;
+ }
initializer = std::unique_ptr<ASTStatement>(new ASTVarDeclarationStatement(
- this->varDeclarations()));
+ std::move(vd)));
break;
}
- // fall through
+ } // fall through
default:
initializer = this->expressionStatement();
}
« no previous file with comments | « src/sksl/SkSLIRGenerator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698