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

Commit 5eea6ae

Browse files
brianosmanSkia Commit-Bot
authored and
Skia Commit-Bot
committed
SkSL: Fail harder when trying to return a value from a void function
This prevents the inliner from getting really confused when the result variable is null, but a return statement appears and tries to use it. Bug: oss-fuzz:25525 Change-Id: Ief85990f707e68e104931a9778ffab35a27acfb1 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315963 Commit-Queue: Brian Osman <[email protected]> Reviewed-by: John Stiles <[email protected]>
1 parent d807039 commit 5eea6ae

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/sksl/SkSLIRGenerator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@ std::unique_ptr<Statement> IRGenerator::convertReturn(const ASTNode& r) {
747747
}
748748
if (fCurrentFunction->fReturnType == *fContext.fVoid_Type) {
749749
fErrors.error(result->fOffset, "may not return a value from a void function");
750+
return nullptr;
750751
} else {
751752
result = this->coerce(std::move(result), fCurrentFunction->fReturnType);
752753
if (!result) {

0 commit comments

Comments
 (0)