skia2/resources/sksl
John Stiles e3a91cf31c Fix fuzzer-discovered error with variable scoping.
In GLSL and SkSL, control statements don't require explicit braces
around single-statement children. That is, the `match = true` child
statement here doesn't need to be braced.

    if (condition) match = true;

Because there are no braces, we never create a Block or a dedicated
SymbolTable here.  This is normally not a problem, but the fuzzer
discovered that it can dump things into the symbol table inside a child
statement:

    if (condition) int newSymbol;

This becomes problematic because the symbol name now outlives its block.
This means `newSymbol` can be referred to later, which should be illegal
(and can cause the optimizer to blow up since the structure is bogus).

There doesn't seem to be any reason to allow this code to compile; the
user can add an explicit scope here to make it reasonable, and it's
(almost) meaningless to declare a symbol that's instantly going to fall
out of scope. This code is now rejected with an error message.

Change-Id: I44778e5b59652d345b10eecd4c88efbf7d86a5e0
Bug: oss-fuzz:29849
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358960
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-26 17:08:59 +00:00
..
blend Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
errors Fix fuzzer-discovered error with variable scoping. 2021-01-26 17:08:59 +00:00
folding Avoid relying on bit-perfect irrational numbers in test code. 2021-01-25 21:27:19 +00:00
fp Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
glsl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
inliner Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
intrinsics Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
metal Allow Metal shaders to return half4 colors. 2021-01-22 23:24:02 +00:00
runtime Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
runtime_errors Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
shared Add unit test for control statements in for loops. 2021-01-26 17:07:51 +00:00
spirv Improve memory layout handling in SPIRV generator 2021-01-22 22:16:48 +00:00
workarounds Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
README.txt Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00

This directory contains source files for testing skslc compilation.
The compiled output files are in the /tests/sksl/ directory.