<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - xinput2 XIQueryDevice reply not read correctly"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=68387#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - xinput2 XIQueryDevice reply not read correctly"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=68387">bug 68387</a>
              from <span class="vcard"><a class="email" href="mailto:ran234@gmail.com" title="Ran Benita <ran234@gmail.com>"> <span class="fn">Ran Benita</span></a>
</span></b>
        <pre>After discussing this with Daniel Martin on irc, the problem in this specific
instance is the following snippet in the generated xinput.c:

    int
    xcb_input_xi_device_info_sizeof (const void  *_buffer  /**< */)
    {
        char *xcb_tmp = (char *)_buffer;
        [...]
        unsigned int xcb_block_len = 0;
        [...]

        xcb_block_len += sizeof(xcb_input_xi_device_info_t);
        xcb_tmp += xcb_block_len;
        /* name */
        xcb_block_len += (((_aux->name_len + 3) / 4) * 4) * sizeof(char);
        xcb_tmp += xcb_block_len;
        [...]
    }

There's a missing

    xcb_block_len = 0;

above the /* name */ comment, which results in xcb_tmp being incremented by
sizeof(xcb_input_xi_device_info_t) twice, which is of course one too many.

This function xcb_input_xi_device_info_sizeof() is used by
xcb_input_xi_device_info_next(), which is used in the test program, which
therefore doesn't work.

Daniel says the problemtic section in c_client.py is this:
<a href="http://cgit.freedesktop.org/xcb/libxcb/tree/src/c_client.py?id=0289348f2c4ed3b1b286c51df19d82c6787c2b36#n1015">http://cgit.freedesktop.org/xcb/libxcb/tree/src/c_client.py?id=0289348f2c4ed3b1b286c51df19d82c6787c2b36#n1015</a>
But that simply adding a 'xcb_block_len = 0;' there breaks other iterators.

The same issue also affects other requests, like XKB's GetGeometry.</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>