[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xcb
Subject:    [Xcb] [Bug 68387] xinput2 XIQueryDevice reply not read correctly
From:       bugzilla-daemon () freedesktop ! org
Date:       2013-08-22 18:51:32
Message-ID: bug-68387-13485-CCKTVmvWpf () http ! bugs ! freedesktop ! org/
[Download RAW message or body]

--1377197491.aA210.28773
Date: Thu, 22 Aug 2013 18:51:31 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"

https://bugs.freedesktop.org/show_bug.cgi?id=68387

--- Comment #6 from Ran Benita <ran234@gmail.com> ---
(In reply to comment #5)
> (In reply to comment #3)
> > For example,
> > I'm pretty sure xcb_get_setup() is broken when there is more than one Screen
> > (roots_len > 1) - in this case the attached program should show garbage.
> 
> Nope, works fine here. I tested this against "Xephyr -screen 1000x500
> -screen 500x500 :1" and diff't the output for the two screens. Only IDs were
> different (e.g. the visual IDs).
> 
> What exactly would you expect to go wrong and why does it still work
> correctly?

Thanks for trying, I didn't know about this Xephyr trick. And you're right;
while xcb_screen_sizeof() uses xcb_tmp, it doesn't in fact increment it twice:

    xcb_block_len += sizeof(xcb_screen_t);
    xcb_tmp += xcb_block_len;
    /* allowed_depths */
    for(i=0; i<_aux->allowed_depths_len; i++) {
        xcb_tmp_len = xcb_depth_sizeof(xcb_tmp);
        xcb_block_len += xcb_tmp_len;
        xcb_tmp += xcb_tmp_len;
    }

i.e in this case the struct and the depths are considered in the same 'block'
(intended or not...). By looking, there aren't any iterator bugs in xproto to
show off :) like in xinput and xkb.

However to 'compensate', xcb_setup_sizeof() is definitely broken, e.g. on my
machine, should be: 5972, reported: 6284. To see this you can add
   printf("offset: %ld\n", (char *) visuals_iter.data - (char *) setup);
right after
   xcb_visualtype_next(&visuals_iter);
and look at the last offset. With the patch the reported sizeof is correct.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.

--1377197491.aA210.28773
Date: Thu, 22 Aug 2013 18:51:31 +0000
MIME-Version: 1.0
Content-Type: text/html; charset="UTF-8"

<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#c6">Comment # 6</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&#64;gmail.com" title="Ran Benita &lt;ran234&#64;gmail.com&gt;"> \
<span class="fn">Ran Benita</span></a> </span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=68387#c5">comment #5</a>)
<span class="quote">&gt; (In reply to <a href="show_bug.cgi?id=68387#c3">comment \
#3</a>) &gt; &gt; For example,
&gt; &gt; I'm pretty sure xcb_get_setup() is broken when there is more than one \
Screen &gt; &gt; (roots_len &gt; 1) - in this case the attached program should show \
garbage. &gt; 
&gt; Nope, works fine here. I tested this against &quot;Xephyr -screen 1000x500
&gt; -screen 500x500 :1&quot; and diff't the output for the two screens. Only IDs \
were &gt; different (e.g. the visual IDs).
&gt; 
&gt; What exactly would you expect to go wrong and why does it still work
&gt; correctly?</span >

Thanks for trying, I didn't know about this Xephyr trick. And you're right;
while xcb_screen_sizeof() uses xcb_tmp, it doesn't in fact increment it twice:

    xcb_block_len += sizeof(xcb_screen_t);
    xcb_tmp += xcb_block_len;
    /* allowed_depths */
    for(i=0; i&lt;_aux-&gt;allowed_depths_len; i++) {
        xcb_tmp_len = xcb_depth_sizeof(xcb_tmp);
        xcb_block_len += xcb_tmp_len;
        xcb_tmp += xcb_tmp_len;
    }

i.e in this case the struct and the depths are considered in the same 'block'
(intended or not...). By looking, there aren't any iterator bugs in xproto to
show off :) like in xinput and xkb.

However to 'compensate', xcb_setup_sizeof() is definitely broken, e.g. on my
machine, should be: 5972, reported: 6284. To see this you can add
   printf(&quot;offset: %ld\n&quot;, (char *) visuals_iter.data - (char *) setup);
right after
   xcb_visualtype_next(&amp;visuals_iter);
and look at the last offset. With the patch the reported sizeof is correct.</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>

--1377197491.aA210.28773--



_______________________________________________
Xcb mailing list
Xcb@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xcb

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic