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

Side by Side Diff: src/sksl/SkSLIRGenerator.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 unified diff | Download patch
« no previous file with comments | « no previous file | src/sksl/SkSLParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkSLIRGenerator.h" 8 #include "SkSLIRGenerator.h"
9 9
10 #include "limits.h" 10 #include "limits.h"
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 return this->convertIndex(std::move(base), *expr); 1221 return this->convertIndex(std::move(base), *expr);
1222 } else if (base->fKind == Expression::kTypeReference_Kind) { 1222 } else if (base->fKind == Expression::kTypeReference_Kind) {
1223 const Type& oldType = ((TypeReference&) *base).fValue; 1223 const Type& oldType = ((TypeReference&) *base).fValue;
1224 Type* newType = new Type(oldType.name() + "[]", Type::kArray_Kin d, oldType, 1224 Type* newType = new Type(oldType.name() + "[]", Type::kArray_Kin d, oldType,
1225 -1); 1225 -1);
1226 fSymbolTable->takeOwnership(newType); 1226 fSymbolTable->takeOwnership(newType);
1227 return std::unique_ptr<Expression>(new TypeReference(fContext, b ase->fPosition, 1227 return std::unique_ptr<Expression>(new TypeReference(fContext, b ase->fPosition,
1228 *newType)); 1228 *newType));
1229 } else { 1229 } else {
1230 fErrors.error(expression.fPosition, "'[]' must follow a type nam e"); 1230 fErrors.error(expression.fPosition, "'[]' must follow a type nam e");
1231 return nullptr;
1231 } 1232 }
1232 } 1233 }
1233 case ASTSuffix::kCall_Kind: { 1234 case ASTSuffix::kCall_Kind: {
1234 auto rawArguments = &((ASTCallSuffix&) *expression.fSuffix).fArgumen ts; 1235 auto rawArguments = &((ASTCallSuffix&) *expression.fSuffix).fArgumen ts;
1235 std::vector<std::unique_ptr<Expression>> arguments; 1236 std::vector<std::unique_ptr<Expression>> arguments;
1236 for (size_t i = 0; i < rawArguments->size(); i++) { 1237 for (size_t i = 0; i < rawArguments->size(); i++) {
1237 std::unique_ptr<Expression> converted = 1238 std::unique_ptr<Expression> converted =
1238 this->convertExpression(*(*rawArguments)[i]); 1239 this->convertExpression(*(*rawArguments)[i]);
1239 if (!converted) { 1240 if (!converted) {
1240 return nullptr; 1241 return nullptr;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 case Expression::kIndex_Kind: 1336 case Expression::kIndex_Kind:
1336 this->markWrittenTo(*((IndexExpression&) expr).fBase); 1337 this->markWrittenTo(*((IndexExpression&) expr).fBase);
1337 break; 1338 break;
1338 default: 1339 default:
1339 fErrors.error(expr.fPosition, "cannot assign to '" + expr.descriptio n() + "'"); 1340 fErrors.error(expr.fPosition, "cannot assign to '" + expr.descriptio n() + "'");
1340 break; 1341 break;
1341 } 1342 }
1342 } 1343 }
1343 1344
1344 } 1345 }
OLDNEW
« no previous file with comments | « no previous file | src/sksl/SkSLParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698