Commit 2cf121d1 by Alexis Hetu Committed by Alexis Hétu

Use of uninitialized value fixed

TParseContext::addConstVectorNode() was returning a TIntermTyped* variable of the wrong type if a swizzle was of a different size than the vector's size. When parseVectorFields() fails, fields.num is reset to 1, which no longer matches fieldString.size(), so fieldString.size() should not have been used. To avoid future errors, the proper type is now set directly within TParseContext::addConstVectorNode(). Bug chromium:796776 Change-Id: Id5e8d1b94d0a03fcf5ef6f5deeb77581bc070288 Reviewed-on: https://swiftshader-review.googlesource.com/17089Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 7ada9ec7
......@@ -2206,7 +2206,9 @@ TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTy
constArray[i] = unionArray[fields.offsets[i]];
}
typedNode = intermediate.addConstantUnion(constArray, node->getType(), line);
TType type(node->getType().getBasicType(), node->getType().getPrecision(), EvqConstExpr, fields.num);
typedNode = intermediate.addConstantUnion(constArray, type, line);
return typedNode;
}
......@@ -2652,11 +2654,6 @@ TIntermTyped *TParseContext::addFieldSelectionExpression(TIntermTyped *baseExpre
recover();
indexedExpression = baseExpression;
}
else
{
indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(),
EvqConstExpr, (unsigned char)(fieldString).size()));
}
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment