Merge pull request #16101 from mtak-/glprogram_buffer_overflow_fix

fix buffer over-read in CCGLProgram.cpp in memcmp call (Address Sanitizer...
This commit is contained in:
Ricardo Quesada 2016-07-14 17:12:17 -07:00 committed by GitHub
commit 9166c28e75
1 changed files with 6 additions and 6 deletions

View File

@ -650,19 +650,19 @@ bool GLProgram::updateUniformLocation(GLint location, const GLvoid* data, unsign
_hashForUniforms.insert(std::make_pair(location, std::make_pair(value, bytes)));
}
else
{
if (memcmp(element->second.first, data, bytes) == 0)
{
updated = false;
}
else
{
if (element->second.second < bytes)
{
GLvoid* value = realloc(element->second.first, bytes);
memcpy(value, data, bytes );
memcpy(value, data, bytes);
_hashForUniforms[location] = std::make_pair(value, bytes);
}
else
{
if (memcmp(element->second.first, data, bytes) == 0)
{
updated = false;
}
else
memcpy(element->second.first, data, bytes);
}