skia2/resources/sksl/errors
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
..
ArgumentCountMismatch.sksl
ArgumentMismatch.sksl
ArgumentModifiers.sksl
ArrayIndexOutOfRange.sksl
ArrayReturnTypes.sksl
ArrayTooManyDimensions.sksl
ArrayUnspecifiedDimensions.sksl
AssignmentTypeMismatch.sksl
BadCaps.sksl
BadFieldAccess.sksl
BadIndex.sksl
BadModifiers.sksl
BinaryInvalidType.sksl
BinaryTypeCoercion.sksl
BinaryTypeMismatch.sksl
BitShiftFloat.sksl
BitShiftFloatMatrix.sksl
BitShiftFloatVector.sksl
BooleanArithmetic.sksl
BreakOutsideLoop.sksl
CallNonFunction.sksl
CanExitWithoutReturningValue.sksl
ConstructorArgumentCount.sksl
ConstructorTypeMismatch.sksl
ContinueOutsideLoop.sksl
DivideByZero.sksl
DoTypeMismatch.sksl
DuplicateFunction.sksl
DuplicateOutput.sksl
DuplicateSymbol.sksl
EnumValueMustBeConstInt.sksl
ErrorsInDeadCode.sksl
FloatRemainder.sksl
ForTypeMismatch.sksl
GenericArgumentMismatch.sksl
GrBadIn.fp
GrMainParameterWrongType.fp
GrMainTooManyParameters.fp
GrNoFragmentProcessorConstruction.fp
GrNoFragmentProcessorExpressions.fp
GrNoFragmentProcessorLocals.fp
GrNoFragmentProcessorParams.fp
GrNoFragmentProcessorReturn.fp
GrRecursion.fp
IfTypeMismatch.sksl
InterfaceBlockScope.sksl
InterfaceBlockStorageModifiers.sksl
InterfaceBlockWithNoMembers.sksl
InvalidAssignment.sksl
InvalidOutParams.sksl
InvalidToken.sksl
InvalidUnary.sksl
InVarWithInitializerExpression.sksl
MismatchedNumbers.sksl
ModifiersInStruct.sksl
OpaqueTypeAssignment.sksl
OpaqueTypeConstruction.sksl
OpaqueTypeInArray.sksl
OpaqueTypeInInterfaceBlock.sksl
OpaqueTypeInStruct.sksl
OpenArray.sksl
Ossfuzz26700.sksl
Ossfuzz26759.sksl
Ossfuzz27650.sksl
Ossfuzz27663.sksl
Ossfuzz29085.sksl
Ossfuzz29845.sksl
Ossfuzz29849.sksl Fix fuzzer-discovered error with variable scoping. 2021-01-26 17:08:59 +00:00
OverflowFloatLiteral.sksl
OverflowIntLiteral.sksl
OverflowParamArraySize.sksl
OverflowUintLiteral.sksl
PrivateTypes.sksl
RedeclareBasicType.sksl
RedeclareEnum.sksl
RedeclareSamplerType.sksl
RedeclareStruct.sksl
RedeclareStructTypeWithName.sksl
RedeclareUserType.sksl
RedeclareVariable.sksl
ReturnDifferentType.sksl
ReturnFromVoid.sksl
ReturnMissingValue.sksl
ReturnTypeMismatch.sksl
SelfReferentialInitializerExpression.sksl
SpuriousFloat.sksl
StaticIfTest.sksl
StaticSwitchConditionalBreak.sksl
StaticSwitchTest.sksl
StructTooDeeplyNested.sksl
SwitchDuplicateCase.sksl
SwitchTypes.sksl
SwizzleConstantOutput.sksl
SwizzleMatrix.sksl
SwizzleOnlyLiterals.sksl
SwizzleOutOfBounds.sksl
SwizzleTooManyComponents.sksl
TernaryMismatch.sksl
UndeclaredFunction.sksl
UndefinedFunction.sksl
UndefinedSymbol.sksl
Unreachable.sksl
UnscopedVariableInDoWhile.sksl Fix fuzzer-discovered error with variable scoping. 2021-01-26 17:08:59 +00:00
UnscopedVariableInElse.sksl Fix fuzzer-discovered error with variable scoping. 2021-01-26 17:08:59 +00:00
UnscopedVariableInIf.sksl Fix fuzzer-discovered error with variable scoping. 2021-01-26 17:08:59 +00:00
UnscopedVariableInWhile.sksl Fix fuzzer-discovered error with variable scoping. 2021-01-26 17:08:59 +00:00
UnsupportedGLSLIdentifiers.sksl
UseWithoutInitializeArrayIndex.sksl
UseWithoutInitializeBinaryExpr.sksl
UseWithoutInitializeDeadIf.sksl
UseWithoutInitializeDeadSwitch.sksl
UseWithoutInitializeReturnValue.sksl
UseWithoutInitializeVarDecl.sksl
UsingInvalidValue.sksl
WhileTypeMismatch.sksl