Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5567a60

Browse files
brianosmanSkia Commit-Bot
authored and
Skia Commit-Bot
committed
Guard traversal of certain kinds of mid-optimization IfStatement
When the test expression has a side-effect, but both the true and else blocks are empty, the optimizer moves the test out to a standalone ExpressionStatement. Updating the usage in that situation involves traversing an IfStatement with no test. Bug: oss-fuzz:26666 Change-Id: I2fb4004f2401784402040345df49a7d42e4aab5e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329960 Reviewed-by: John Stiles <[email protected]> Commit-Queue: Brian Osman <[email protected]>
1 parent fdf6148 commit 5567a60

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/sksl/SkSLAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ bool TProgramVisitor<PROG, EXPR, STMT, ELEM>::visitStatement(STMT s) {
558558
}
559559
case Statement::Kind::kIf: {
560560
auto& i = s.template as<IfStatement>();
561-
return this->visitExpression(*i.test()) ||
561+
return (i.test() && this->visitExpression(*i.test())) ||
562562
(i.ifTrue() && this->visitStatement(*i.ifTrue())) ||
563563
(i.ifFalse() && this->visitStatement(*i.ifFalse()));
564564
}

0 commit comments

Comments
 (0)