KalebDark / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 0 forks source link

Shader::setSource is broken #837

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Shader::setSource does not take the "length" parameter into account.

Fixed version:

void Shader::setSource(GLsizei count, const char *const *string, const GLint 
*length)
{
 std::ostringstream stream;

 for(int i = 0; i < count; i++)
 {
  stream << std::string(string[i], length[i]);
 }

 mSource = stream.str();
}

was:

void Shader::setSource(GLsizei count, const char *const *string, const GLint 
*length)
{
    std::ostringstream stream;
    for (int i = 0; i < count; i++)
    {
        stream << string[i];
    }
    mSource = stream.str();
}

Original issue reported on code.google.com by mastery...@googlemail.com on 21 Nov 2014 at 5:23

GoogleCodeExporter commented 9 years ago
It looks like when we converted to use stringstream, we lost handling for 
non-null-terminated strings. Geoff, can you take a look?

Original comment by shannonw...@chromium.org on 21 Nov 2014 at 9:29

GoogleCodeExporter commented 9 years ago
Thanks for the report.  The fix isn't quite so simple since the length pointer 
can be null or contain negative values.  I'll try to get the fix in today.

Original comment by geofflang@chromium.org on 24 Nov 2014 at 3:46

GoogleCodeExporter commented 9 years ago
https://chromium-review.googlesource.com/#/c/231612/

Original comment by geofflang@chromium.org on 24 Nov 2014 at 6:55

GoogleCodeExporter commented 9 years ago

Original comment by geofflang@chromium.org on 24 Nov 2014 at 7:05