<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - xcb_xv_query_adaptors accesses invalid memory due to xcb_xv_adaptor_info_sizeof returning non-aligned value"
href="https://bugs.freedesktop.org/show_bug.cgi?id=79808#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - xcb_xv_query_adaptors accesses invalid memory due to xcb_xv_adaptor_info_sizeof returning non-aligned value"
href="https://bugs.freedesktop.org/show_bug.cgi?id=79808">bug 79808</a>
from <span class="vcard"><a class="email" href="mailto:robert.ancell@gmail.com" title="Robert Ancell <robert.ancell@gmail.com>"> <span class="fn">Robert Ancell</span></a>
</span></b>
<pre>Debugging shows it's the the padding after the name that's not being taken into
account:
<struct name="AdaptorInfo">
<field type="PORT" name="base_id" />
<field type="CARD16" name="name_size" />
<field type="CARD16" name="num_ports" />
<field type="CARD16" name="num_formats" />
<field type="CARD8" name="type" mask="Type" />
<pad bytes="1" />
<list type="char" name="name">
<fieldref>name_size</fieldref>
</list>
<list type="Format" name="formats">
<fieldref>num_formats</fieldref>
</list>
</struct>
In xcb_xv_adaptor_info_sizeof () the logic is:
/* name */
xcb_block_len += _aux->name_size * sizeof(char);
xcb_tmp += xcb_block_len;
xcb_align_to = ALIGNOF(char);
/* insert padding */
xcb_pad = -xcb_block_len & (xcb_align_to - 1);
xcb_buffer_len += xcb_block_len + xcb_pad;
if (0 != xcb_pad) {
xcb_tmp += xcb_pad;
xcb_pad = 0;
}
xcb_block_len = 0;
But ALIGNOF(char) returns 1 so no padding is added.</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>