<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Invalid memory access in xcb_icccm_get_wm_class_from_reply"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=93268">93268</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Invalid memory access in xcb_icccm_get_wm_class_from_reply
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>XCB
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Utils
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>xcb@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jpinon@free.fr
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>xcb@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I fell in a case where in xcb_icccm_get_wm_class_from_reply, the reply was
empty, i.e., in following snippet from icccm.c, len was 0, and reply->length
was 0 also.

  int len = xcb_get_property_value_length(prop->_reply);
  if(len < reply->length * 4)
    prop->instance_name[len] = 0;
  else
    prop->instance_name[len-1] = 0;

in this case, prop->instance_name[-1] is set to 0, and the following
strlen(prop->instance_name) may access invalid memory.

This may be reproduced under openbox window manager, under which there is this
window triggering the bug :

If xwininfo is compiled without icccm :
./xwininfo -tree -root | grep Openbox
     0xe0008b "Openbox": ("" (none))  1x1+-100+-100  +-100+-100

If xwininfo is compiled with icccm :
./xwininfo -tree -root | grep Openbox                                           
     0xe0008b "Openbox": ("" "")  1x1+-100+-100  +-100+-100

The second case triggers the Invalid memory access</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>