Linux-Bluetooth Archive on lore.kernel.org
 help / Atom feed
* [PATCH BlueZ 1/2] avrcp: Fix error creating media items
@ 2018-12-06  0:00 Luiz Augusto von Dentz
  2018-12-06  0:00 ` [PATCH BlueZ 2/2] gdbus: Make sure the object path and interface are valid Luiz Augusto von Dentz
  2018-12-12 16:31 ` [PATCH BlueZ 1/2] avrcp: Fix error creating media items Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2018-12-06  0:00 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Don't use item name in the object since it would need to be properly
escaped if the remote stack uses UID 0, instead just create the path
using the object pointer even  though it is invalid to have 0 as UID:

AVRCP 1.6.1, page 84:

  'The value of UID=0x0 is a special value used only to request
   the metadata for the currently playing media using the
   GetElementAttributes command and shall not be used for any item
   in a folder.'
---
 profiles/audio/player.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index 048f98f96..ac23f720b 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -1800,11 +1800,11 @@ static struct media_item *media_folder_create_item(struct media_player *mp,
 	item->player = mp;
 	item->uid = uid;
 
-	if (uid > 0)
+	if (!uid && name[0] == '/')
+		item->path = g_strdup_printf("%s%s", mp->path, name);
+	else
 		item->path = g_strdup_printf("%s/item%" PRIu64 "",
 						folder->item->path, uid);
-	else
-		item->path = g_strdup_printf("%s%s", mp->path, name);
 
 	item->name = g_strdup(name);
 	item->type = type;
-- 
2.17.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH BlueZ 2/2] gdbus: Make sure the object path and interface are valid
  2018-12-06  0:00 [PATCH BlueZ 1/2] avrcp: Fix error creating media items Luiz Augusto von Dentz
@ 2018-12-06  0:00 ` Luiz Augusto von Dentz
  2018-12-12 16:31 ` [PATCH BlueZ 1/2] avrcp: Fix error creating media items Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2018-12-06  0:00 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

D-Bus object path and interface must be validate otherwise it can cause
errors as follow:

0  0xb7f67ab1 in __kernel_vsyscall ()
1  0xb7ca1cc1 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
2  0xb7ca50ee in abort () at abort.c:92
3  0xb7e30ba5 in _dbus_abort () at dbus-sysdeps.c:94
4  0xb7e267a6 in _dbus_warn_check_failed (
    format=0xb7e36cd4 "arguments to %s() were incorrect, assertion \"%s\" failed in file %s line %d.\nThis is normally a bug in some application using the D-Bus library.\n") at dbus-internals.c:290
5  0xb7e16d9f in dbus_message_iter_append_basic (iter=0xbf864400, type=111,
    value=0xd70940) at dbus-message.c:2586
6  0x004fcdec in emit_interfaces_added (user_data=0xd70938)
    at gdbus/object.c:574
---
 gdbus/object.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gdbus/object.c b/gdbus/object.c
index 617ab5eda..830175385 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -1346,6 +1346,10 @@ gboolean g_dbus_register_interface(DBusConnection *connection,
 {
 	struct generic_data *data;
 
+	if (!dbus_validate_path(path, NULL) ||
+				!dbus_validate_interface(name, NULL))
+		return FALSE;
+
 	data = object_path_ref(connection, path);
 	if (data == NULL)
 		return FALSE;
-- 
2.17.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ 1/2] avrcp: Fix error creating media items
  2018-12-06  0:00 [PATCH BlueZ 1/2] avrcp: Fix error creating media items Luiz Augusto von Dentz
  2018-12-06  0:00 ` [PATCH BlueZ 2/2] gdbus: Make sure the object path and interface are valid Luiz Augusto von Dentz
@ 2018-12-12 16:31 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2018-12-12 16:31 UTC (permalink / raw)
  To: linux-bluetooth

Hi,
On Thu, Dec 6, 2018 at 2:00 AM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> Don't use item name in the object since it would need to be properly
> escaped if the remote stack uses UID 0, instead just create the path
> using the object pointer even  though it is invalid to have 0 as UID:
>
> AVRCP 1.6.1, page 84:
>
>   'The value of UID=0x0 is a special value used only to request
>    the metadata for the currently playing media using the
>    GetElementAttributes command and shall not be used for any item
>    in a folder.'
> ---
>  profiles/audio/player.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/profiles/audio/player.c b/profiles/audio/player.c
> index 048f98f96..ac23f720b 100644
> --- a/profiles/audio/player.c
> +++ b/profiles/audio/player.c
> @@ -1800,11 +1800,11 @@ static struct media_item *media_folder_create_item(struct media_player *mp,
>         item->player = mp;
>         item->uid = uid;
>
> -       if (uid > 0)
> +       if (!uid && name[0] == '/')
> +               item->path = g_strdup_printf("%s%s", mp->path, name);
> +       else
>                 item->path = g_strdup_printf("%s/item%" PRIu64 "",
>                                                 folder->item->path, uid);
> -       else
> -               item->path = g_strdup_printf("%s%s", mp->path, name);
>
>         item->name = g_strdup(name);
>         item->type = type;
> --
> 2.17.2

Applied.


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06  0:00 [PATCH BlueZ 1/2] avrcp: Fix error creating media items Luiz Augusto von Dentz
2018-12-06  0:00 ` [PATCH BlueZ 2/2] gdbus: Make sure the object path and interface are valid Luiz Augusto von Dentz
2018-12-12 16:31 ` [PATCH BlueZ 1/2] avrcp: Fix error creating media items Luiz Augusto von Dentz

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable: git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org linux-bluetooth@archiver.kernel.org
	public-inbox-index linux-bluetooth


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/ public-inbox