FS#63337 - [dbus-c++] assert fail when copying data from received message

Attached to Project: Arch Linux
Opened by Théo Goudout (Theobalt) - Thursday, 01 August 2019, 09:02 GMT
Last edited by David Runge (dvzrv) - Saturday, 02 September 2023, 14:39 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To David Runge (dvzrv)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

I'm using a DBus method returning a Variant containing an object with signature a{sa{sv}}. When reaching a Variant value, a seg fault signal is emitted.

When recompiling libdbus with checks, the following assert message is printed:

dbus[27636]: arguments to dbus_message_iter_open_container() were incorrect, assertion "(type == DBUS_TYPE_STRUCT && contained_signature == NULL) || (type == DBUS_TYPE_DICT_ENTRY && contained_signature == NULL) || (type == DBUS_TYPE_VARIANT && contained_signature != NULL) || (type == DBUS_TYPE_ARRAY && contained_signature != NULL)" failed in file dbus-message.c line 2966.

This is coming from a wrong parameter in 'dbus_message_iter_open_container' call in file 'message.cpp:349'. The type is supposed to be NULL when reading a DBUS_TYPE_STRUCT or a DBUS_TYPE_DICT_ENTRY. Currently, it's NULL for DBUS_TYPE_VARIANT.

/!\ The problem will not show if libdbus is not recompiled and reading a struct of a dict_entry. /!\

I've attached a patch that fixes it. In my opinion, the libdbus-c++ project is not really active and the patch should be added to the package.

Additional info:
* package version(s) : 0.9.0-8
* link to upstream bug report : https://sourceforge.net/p/dbus-cplusplus/patches/27/

Steps to reproduce:

1. Recompile libdbus without '--disable-checks' and '--disable-asserts' parameters.
3. Compile test.cpp : g++ test.cpp -o test $(pkg-config dbus-c++-1 --cflags --libs)
2. Run test program : ./test
This task depends upon

Closed by  David Runge (dvzrv)
Saturday, 02 September 2023, 14:39 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed with dbus-c++ 0.9.0-11
Comment by David Runge (dvzrv) - Thursday, 11 June 2020, 10:53 GMT
@Theobalt: Thanks for the report!

I will look into this as time permits.
Thanks for providing a patch!
Comment by Buggy McBugFace (bugbot) - Tuesday, 08 August 2023, 19:11 GMT
This is an automated comment as this bug is open for more then 2 years. Please reply if you still experience this bug otherwise this issue will be closed after 1 month.
Comment by David Runge (dvzrv) - Saturday, 02 September 2023, 14:38 GMT
@Theobalt: Sorry this took so long to apply. The fix will be made available in a pkgrel bump!

Loading...