Bug ID 923768
Summary bluez contains broken testsuite
Classification openSUSE
Product openSUSE Factory
Version 201503*
Hardware Other
OS Other
Status NEW
Severity Normal
Priority P5 - None
Component Network
Assignee bnc-team-screening@forge.provo.novell.com
Reporter rguenther@suse.com
QA Contact qa-bugs@suse.de
Found By ---
Blocker ---

bluez fails to build with GCC 5 because it contains massive undefined behavior.
For example unit/test-avrcp.c main() has

        /* SetBrowsedPlayer - TG */
        define_test("/TP/MPS/BI-02-C", test_server,
                        brs_pdu(0x00, 0x11, 0x0e, 0x70, 0x00, 0x02,
                                0xab, 0xcd),
                        brs_pdu(0x02, 0x11, 0x0e, 0x70, 0x00, 0x01,
                                0x11));


        /*
         * Media Content Navigation Commands and Notifications for Content
         * Browsing.
         */

        /* GetFolderItems - Virtual FS - CT */
        define_test("/TP/MCN/CB/BV-01-C", test_client,
                        brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
                                0x00, 0x0a, AVRCP_MEDIA_PLAYER_VFS,
                                0x00, 0x00, 0x00, 0x00, /* start */
                                0x00, 0x00, 0x00, 0x02, /* end */
                                0x00));

which expands via macros to

# 1205 "unit/test-avrcp.c"
 do { const struct test_pdu pdus[] = { { .valid =
# 1205 "unit/test-avrcp.c" 3 4
1
# 1205 "unit/test-avrcp.c"
, .browse =
# 1205 "unit/test-avrcp.c" 3 4
1
# 1205 "unit/test-avrcp.c"
, .data = ((const unsigned char[]) { 0x00, 0x11, 0x0e, 0x70, 0x00, 0x02, 0xab,
0xcd }), .size = sizeof(((const unsigned char[]) { 0x00, 0x11, 0x0e, 0x70,
0x00, 0x02, 0xab, 0xcd })), }, { .valid =
# 1205 "unit/test-avrcp.c" 3 4
1
# 1205 "unit/test-avrcp.c"
, .browse =
# 1205 "unit/test-avrcp.c" 3 4
1
# 1205 "unit/test-avrcp.c"
, .data = ((const unsigned char[]) { 0x02, 0x11, 0x0e, 0x70, 0x00, 0x01, 0x11
}), .size = sizeof(((const unsigned char[]) { 0x02, 0x11, 0x0e, 0x70, 0x00,
0x01, 0x11 })), }, { } }; static struct test_data data; data.test_name =
g_strdup("/TP/MPS/BI-02-C"); data.pdu_list = g_malloc(sizeof(pdus));
memcpy(data.pdu_list, pdus, sizeof(pdus));
g_test_add_data_func("/TP/MPS/BI-02-C", &data, test_server); } while (0)



          ;
# 1218 "unit/test-avrcp.c"
 do { const struct test_pdu pdus[] = { { .valid =
# 1218 "unit/test-avrcp.c" 3 4
1
# 1218 "unit/test-avrcp.c"
, .browse =
# 1218 "unit/test-avrcp.c" 3 4
1
# 1218 "unit/test-avrcp.c"
, .data = ((const unsigned char[]) { 0x00, 0x11, 0x0e, 0x71, 0x00, 0x0a, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00 }), .size = sizeof(((const
unsigned char[]) { 0x00, 0x11, 0x0e, 0x71, 0x00, 0x0a, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00 })), }, { } }; static struct test_data data;
data.test_name = g_strdup("/TP/MCN/CB/BV-01-C"); data.pdu_list =
g_malloc(sizeof(pdus)); memcpy(data.pdu_list, pdus, sizeof(pdus));
g_test_add_data_func("/TP/MCN/CB/BV-01-C", &data, test_client); } while (0)




          ;


which as you can see passes &data to g_test_add_data_func where 'data' is a
automatic variable that goes out-of-scope after the define_test macro
invocation.  GCC now simply re-uses the storage for 'data' and the tests
get garbled test data.

Please fix.


You are receiving this mail because: