skia2/resources/sksl/errors/UsingInvalidValue.sksl
John Stiles b05bbd03f9 Fix for fuzzer-discovered error with invalid var-initializers.
If a VarDeclaration line contained multiple variables, and the first
variable had an illegal initializer-expression, the Declare() would
return a Nop. AddVarDeclaration did not expect to see a Nop and would
assert once we tried to process the second var-declaration. Now, we
allow adding var declarations to a Nop.

Bulked up some tests to cover local and global variables (since those
are parsed in separate functions) and to check both the first
initializer as well as follow-on initializers (since those are parsed in
separate parts of the var-decl handler).

Change-Id: I66341191698175b490a659715cb8edaafe2f75ae
Bug: oss-fuzz:39032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452696
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-24 20:15:31 +00:00

12 lines
589 B
Plaintext

int func() { return 1; }
void expect_constructor_invocation() { int x = int; }
void expect_constructor_invocation_extra_initializer() { int x, y = int; }
void expect_function_call() { int x = func; }
void expect_function_call_extra_initializer() { int x, y = func; }
int g_expect_constructor_invocation = int;
int g_expect_constructor_invocation_extra_initializer, ix = int;
int g_expect_function_call = func;
int g_expect_function_call_extra_initializer, iy = func;