Fixed DSLParser error uncovered by ossfuzz

Missed one more case of Optional<Wrapper<Expression>>. This should be
the last one.

Bug: oss-fuzz:38944
Change-Id: Ic7f790cd99e2a3ee1c3874cc767a4702265d1723
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450476
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
Ethan Nicholas 2021-09-20 10:18:58 -04:00 committed by SkCQ
parent 3d9c73c100
commit f62934b85a
4 changed files with 10 additions and 3 deletions

View File

@ -108,6 +108,7 @@ sksl_error_tests = [
"/sksl/errors/Ossfuzz38140.sksl",
"/sksl/errors/Ossfuzz38560.sksl",
"/sksl/errors/Ossfuzz38865.sksl",
"/sksl/errors/Ossfuzz38944.sksl",
"/sksl/errors/OverflowFloatLiteral.sksl",
"/sksl/errors/OverflowIntLiteral.sksl",
"/sksl/errors/OverflowInt64Literal.sksl",

View File

@ -0,0 +1 @@
int a = log(

View File

@ -1666,11 +1666,11 @@ DSLExpression DSLParser::suffix(DSLExpression base) {
ExpressionArray args;
if (this->peek().fKind != Token::Kind::TK_RPAREN) {
for (;;) {
skstd::optional<DSLWrapper<DSLExpression>> expr = this->assignmentExpression();
if (!expr) {
DSLExpression expr = this->assignmentExpression();
if (!expr.hasValue()) {
return {};
}
args.push_back((**expr).release());
args.push_back(expr.release());
if (!this->checkNext(Token::Kind::TK_COMMA)) {
break;
}

View File

@ -0,0 +1,5 @@
### Compilation failed:
error: 1: expected expression, but found ''
error: 1: expected ';', but found ''
2 errors