Commit 284bb656 by Alexis Hetu Committed by Alexis Hétu

Fixed Program::getAttachedShaders

It was possible to have "count" larger than "maxCount" since "total" was incremented regardless of whether or not the shader was added to the "shaders" output argument. Simplified the function to fix it. Change-Id: I403e6c100580fb8f5f1c6fe170af1a796e936828 Reviewed-on: https://swiftshader-review.googlesource.com/3605Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 61435667
...@@ -2367,24 +2367,14 @@ namespace es2 ...@@ -2367,24 +2367,14 @@ namespace es2
{ {
int total = 0; int total = 0;
if(vertexShader) if(vertexShader && (total < maxCount))
{
if(total < maxCount)
{ {
shaders[total] = vertexShader->getName(); shaders[total++] = vertexShader->getName();
}
total++;
} }
if(fragmentShader) if(fragmentShader && (total < maxCount))
{
if(total < maxCount)
{ {
shaders[total] = fragmentShader->getName(); shaders[total++] = fragmentShader->getName();
}
total++;
} }
if(count) if(count)
......
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