[PATCH BlueZ v2 4/4] unit/test-sdp-xml: Add a test parsing alternates
Luiz Augusto von Dentz <[email protected]>
| Newsgroups | org.kernel.vger.linux-bluetooth |
|---|---|
| Message-ID | <[email protected]> |
From: Luiz Augusto von Dentz <[email protected]> None of the existing records contain an <alternate>, so nothing covered the SDP_ALT8, SDP_ALT16 and SDP_ALT32 handling. Add a record with an alternate holding an integer, a string and a nested sequence, which leaks its members under valgrind without the previous sdp_data_free() fix. Assisted-by: Claude:claude-opus-5 --- Makefile.am | 1 + unit/sdp-xml/alternate.xml | 12 ++++++++++++ unit/test-sdp-xml.c | 1 + 3 files changed, 14 insertions(+) create mode 100644 unit/sdp-xml/alternate.xml diff --git a/Makefile.am b/Makefile.am index 3c6cf92ab403..2754e1b7f2da 100644 --- a/Makefile.am +++ b/Makefile.am @@ -648,6 +648,7 @@ unit_test_sdp_xml_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) -DTOP_SRCDIR=\""$(srcdir) unit_test_sdp_xml_CPPFLAGS = -I$(srcdir)/lib EXTRA_DIST += unit/sdp-xml/Bluetooth_HID-sdp_record.xml \ + unit/sdp-xml/alternate.xml \ unit/sdp-xml/compute-seq-size-type-confusion.xml \ unit/sdp-xml/duplicate-attribute.xml \ unit/sdp-xml/qt-SerialPortSDPRecord.xml diff --git a/unit/sdp-xml/alternate.xml b/unit/sdp-xml/alternate.xml new file mode 100644 index 000000000000..a35ebccbc71f --- /dev/null +++ b/unit/sdp-xml/alternate.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<record> + <attribute id="0x0004"> + <alternate> + <uint32 value="0x11223344" /> + <text value="alternate-member" /> + <sequence> + <uint16 value="0x0100" /> + </sequence> + </alternate> + </attribute> +</record> diff --git a/unit/test-sdp-xml.c b/unit/test-sdp-xml.c index b338788aa295..cb5b91717fca 100644 --- a/unit/test-sdp-xml.c +++ b/unit/test-sdp-xml.c @@ -133,6 +133,7 @@ int main(int argc, char *argv[]) DEFINE_TEST("compute-seq-size-type-confusion.xml", FALSE); /* From https://github.com/bluez/bluez/security/advisories/GHSA-75v6-6q44-57hc */ DEFINE_TEST("duplicate-attribute.xml", TRUE); + DEFINE_TEST("alternate.xml", TRUE); tester_add("/sequence_on_squared", &data, sequence_on_squared_setup, -- 2.54.0