<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_ASSIGNED "
   title="ASSIGNED - Query INFO_LOG_LENGTH for empty info log should return 0"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=97321#c12">Comment # 12</a>
              on <a class="bz_bug_link 
          bz_status_ASSIGNED "
   title="ASSIGNED - Query INFO_LOG_LENGTH for empty info log should return 0"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=97321">bug 97321</a>
              from <span class="vcard"><a class="email" href="mailto:qiankun.miao@intel.com" title="Qiankun Miao <qiankun.miao@intel.com>"> <span class="fn">Qiankun Miao</span></a>
</span></b>
        <pre>(In reply to Ian Romanick from <a href="show_bug.cgi?id=97321#c9">comment #9</a>)
<span class="quote">> I guess the point is that you can't change one and not change the other.  I
> will not budge on that.

> I also think it is wrong for glGetProgramInfoLog to not write a NUL when the
> info log is empty.  An application that does something like


>     glGetProgramInfoLog(prog, max_length, NULL, log);
>     printf("Info log:\n%s\n", log);

> will print whatever garbage happens to be in log.  You may argue that the
> application is incorrect, but this usage is very, very common (among users
> of glGetProgramInfoLog).</span >

max_length should make sure "log" doesn't overflow, otherwise it's a bug of
glGetProgramInfoLog implementation. 

Here is the usage of these two apis in chrome:
void Program::UpdateLogInfo() {
  GLint max_len = 0;
  glGetProgramiv(service_id_, GL_INFO_LOG_LENGTH, &max_len);
  if (max_len == 0) {
    set_log_info(nullptr);
    return;
  }
  std::unique_ptr<char[]> temp(new char[max_len]);
  GLint len = 0;
  glGetProgramInfoLog(service_id_, max_len, &len, temp.get());
  DCHECK(max_len == 0 || len < max_len);
  DCHECK(len == 0 || temp[len] == '\0');
  std::string log(temp.get(), len);
  log = ProcessLogInfo(log);
  set_log_info(log.empty() ? nullptr : log.c_str());
}

Application should handle max_len returned 0. If application didn't handle
that, glGetProgramInfoLog should make sure no buffer overflow for "max_len ==
0".</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>