Bug 22141

Summary: dbus_message_marshal() can produce invalid messages.
Product: dbus Reporter: Will Thompson <will>
Component: coreAssignee: Havoc Pennington <hp>
Status: RESOLVED FIXED QA Contact: John (J5) Palmieri <johnp>
Severity: normal    
Priority: medium CC: walters
Version: unspecified   
Hardware: Other   
OS: All   
URL: http://git.collabora.co.uk/?p=user/wjt/dbus.git;a=shortlog;h=refs/heads/fill-in-length-before-marshalling
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 19723    
Attachments: Ensure messages are locked while marshalling.
A better patch that doesn't erroneously leave the message locked

Description Will Thompson 2009-06-07 09:57:42 UTC
Created attachment 26513 [details] [review]
Ensure messages are locked while marshalling.

While exposing marshal() and demarshal() in the Python binding, Ben Schwartz found that the former produces messages that the latter rejects. This turns out to be because the length header is wrong.

The attached patch (also available at <http://git.collabora.co.uk/?p=user/wjt/dbus.git;a=shortlog;h=refs/heads/fill-in-length-before-marshalling>) attempts to fix this by ensuring the message is locked while it's being marshalled. I haven't tested it, mind; perhaps a regression test would be a good idea.
Comment 1 Will Thompson 2009-06-07 11:00:19 UTC
Created attachment 26514 [details] [review]
A better patch that doesn't erroneously leave the message locked

Ben noticed that my original patch left the message locked if _dbus_string_init () failed. I've updated the branch accordingly.
Comment 2 Thiago Macieira 2009-06-15 16:22:19 UTC
Patch looks OK. Recommend committing it.
Comment 3 Colin Walters 2009-07-10 16:48:04 UTC
Applied, thanks!

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.