Commit 99cf9c1f authored by apisarev's avatar apisarev Committed by Commit bot

Initialize arrays before use.

In edited code is possible usage of not initialized array. It's caused
by reason, that GetProgramInfoLog and GetShaderInfoLog functions can end
without filling of the passed array. This error can be detected by MSan.
To fix this problem arrays was initialized before being passed and
printed.

R=aelias@chromium.org
BUG=None
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Review-Url: https://codereview.chromium.org/2600113002
Cr-Commit-Position: refs/heads/master@{#440964}
parent 49015762
...@@ -57,7 +57,7 @@ bool ProgramBindingBase::Link(GLES2Interface* context) { ...@@ -57,7 +57,7 @@ bool ProgramBindingBase::Link(GLES2Interface* context) {
int linked = 0; int linked = 0;
context->GetProgramiv(program_, GL_LINK_STATUS, &linked); context->GetProgramiv(program_, GL_LINK_STATUS, &linked);
if (!linked) { if (!linked) {
char buffer[1024]; char buffer[1024] = "";
context->GetProgramInfoLog(program_, sizeof(buffer), nullptr, buffer); context->GetProgramInfoLog(program_, sizeof(buffer), nullptr, buffer);
DLOG(ERROR) << "Error compiling shader: " << buffer; DLOG(ERROR) << "Error compiling shader: " << buffer;
return false; return false;
...@@ -96,7 +96,7 @@ unsigned ProgramBindingBase::LoadShader(GLES2Interface* context, ...@@ -96,7 +96,7 @@ unsigned ProgramBindingBase::LoadShader(GLES2Interface* context,
int compiled = 0; int compiled = 0;
context->GetShaderiv(shader, GL_COMPILE_STATUS, &compiled); context->GetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
if (!compiled) { if (!compiled) {
char buffer[1024]; char buffer[1024] = "";
context->GetShaderInfoLog(shader, sizeof(buffer), nullptr, buffer); context->GetShaderInfoLog(shader, sizeof(buffer), nullptr, buffer);
DLOG(ERROR) << "Error compiling shader: " << buffer DLOG(ERROR) << "Error compiling shader: " << buffer
<< "\n shader program: " << shader_source; << "\n shader program: " << shader_source;
......
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