Bug 34037

Summary: xcb_str_next uses padding when there isn't any
Product: XCB Reporter: Erkki Seppälä <erkki.seppala>
Component: LibraryAssignee: xcb mailing list dummy <xcb>
Status: RESOLVED FIXED QA Contact: xcb mailing list dummy <xcb>
Severity: normal    
Priority: medium CC: psychon
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: A short utility to list the extensions of the X server

Description Erkki Seppälä 2011-02-08 07:03:28 UTC
Created attachment 43105 [details]
A short utility to list the extensions of the X server

xcb_str_next iterates through lists of strings, which are of format <string length><string contents><string length><string contents> etc. However, this list does not have padding. 

c_client.py generates a function xcb_str_sizeof, which calculates the length of one of those strings, but at least in the context of strings the additional padding isn't there. This is the function used by the new xcb_str_next to determine the next offset to jump into.

Attached is a program to list X extensions of the server. It fails unless the accompanied fixed_xcb_str_next is used.

The issue is between XCB 1.7 and the GIT HEAD. I suspect the issue may be related to change 77b594f9583ea0247ff27130316d8e045da7f921 (because it generates the _sizeof functions), but that cannot be easily reverted by itself. In any case I found that that problem-inducing commit is between the good commit 
8c2707773b3621fb8bbda9021d23944f5be34aab and the bad commit 22e1013131984a217e9bddeac3a6a4183e35f0c1; I had trouble compiling the versions in-between.
Comment 1 Peter Harris 2011-08-24 07:36:50 UTC
Fixed in aa02096b8e7f94ad3c998a8d5af54963ee860b13

Thanks to Uli Schlachter.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.