Initialize array size on error. The array size is set using the value returned by arraySizeErrorCheck, even when an error occurred, so don't leave it uninitialized. Bug chromium:801648 Change-Id: If2af27c5f61dca2931796f1681dce61ab6a44341 Reviewed-on: https://swiftshader-review.googlesource.com/18368 Tested-by: Nicolas Capens <nicolascapens@google.com> Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/OpenGL/compiler/ParseHelper.cpp b/src/OpenGL/compiler/ParseHelper.cpp index c7100ba..6d4b149 100644 --- a/src/OpenGL/compiler/ParseHelper.cpp +++ b/src/OpenGL/compiler/ParseHelper.cpp
@@ -802,6 +802,7 @@ if (expr->getQualifier() != EvqConstExpr || constant == 0 || !constant->isScalarInt()) { error(line, "array size must be a constant integer expression", ""); + size = 1; return true; } @@ -1485,7 +1486,7 @@ TType arrayType(publicType); - int size; + int size = 0; if(arraySizeErrorCheck(identifierLocation, indexExpression, size)) { recover(); @@ -1666,7 +1667,7 @@ else { TType arrayType = TType(publicType); - int size; + int size = 0; if(arraySizeErrorCheck(arrayLocation, indexExpression, size)) { recover();