Added reportPendingErrors to SkSL code generation
This fixes an assertion failure uncovered by the fuzzer.
Bug: oss-fuzz:37469
Change-Id: I626c003cfa8a0bc65851899df3a7695dbe29200b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441311
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
diff --git a/gn/sksl_tests.gni b/gn/sksl_tests.gni
index b39a591..03aa4aa 100644
--- a/gn/sksl_tests.gni
+++ b/gn/sksl_tests.gni
@@ -188,6 +188,7 @@
"/sksl/spirv/Ossfuzz35916.sksl",
"/sksl/workarounds/RewriteMatrixVectorMultiply.sksl",
"/sksl/errors/Ossfuzz36850.sksl",
+ "/sksl/errors/Ossfuzz37469.sksl",
"/sksl/errors/UndefinedFunction.sksl",
"/sksl/errors/UnusedInterfaceBlock.sksl",
]
diff --git a/resources/sksl/errors/Ossfuzz37469.sksl b/resources/sksl/errors/Ossfuzz37469.sksl
new file mode 100644
index 0000000..3c22758
--- /dev/null
+++ b/resources/sksl/errors/Ossfuzz37469.sksl
@@ -0,0 +1 @@
+k{int z;}m[];void main(){}
\ No newline at end of file
diff --git a/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp b/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp
index 5ad8ef8..194ced7 100644
--- a/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp
+++ b/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp
@@ -3789,6 +3789,7 @@
this->writeWord(fIdCount, *fOut);
this->writeWord(0, *fOut); // reserved, always zero
write_stringstream(buffer, *fOut);
+ fContext.fErrors->reportPendingErrors(PositionInfo());
return fContext.fErrors->errorCount() == 0;
}
diff --git a/tests/sksl/errors/Ossfuzz37469.asm.frag b/tests/sksl/errors/Ossfuzz37469.asm.frag
new file mode 100644
index 0000000..994061e
--- /dev/null
+++ b/tests/sksl/errors/Ossfuzz37469.asm.frag
@@ -0,0 +1,4 @@
+### Compilation failed:
+
+error: runtime-sized arrays are not supported in SPIR-V
+1 error