From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6274D158086 for ; Tue, 26 Oct 2021 15:02:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 968C9E07FE; Tue, 26 Oct 2021 15:02:35 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7EB15E07FE for ; Tue, 26 Oct 2021 15:02:35 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 738EA3439EF for ; Tue, 26 Oct 2021 15:02:34 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1220C79 for ; Tue, 26 Oct 2021 15:02:33 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1635260529.30bd9772a9ab6da8a9c0d6875fd08322d89cada1.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/pipewire/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: media-video/pipewire/files/pipewire-0.3.39-endian-test-fix.patch X-VCS-Directories: media-video/pipewire/files/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 30bd9772a9ab6da8a9c0d6875fd08322d89cada1 X-VCS-Branch: master Date: Tue, 26 Oct 2021 15:02:33 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: ba16cd09-d16f-44b9-a454-02be490339d4 X-Archives-Hash: 53dbd612d82e223b9e6ecbd26625c765 commit: 30bd9772a9ab6da8a9c0d6875fd08322d89cada1 Author: Sam James gentoo org> AuthorDate: Tue Oct 26 15:01:38 2021 +0000 Commit: Sam James gentoo org> CommitDate: Tue Oct 26 15:02:09 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30bd9772 media-video/pipewire: add another upstream patch to fix build failure Closes: https://bugs.gentoo.org/820365 Signed-off-by: Sam James gentoo.org> .../files/pipewire-0.3.39-endian-test-fix.patch | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/media-video/pipewire/files/pipewire-0.3.39-endian-test-fix.patch b/media-video/pipewire/files/pipewire-0.3.39-endian-test-fix.patch index a8febb81491..2687299b235 100644 --- a/media-video/pipewire/files/pipewire-0.3.39-endian-test-fix.patch +++ b/media-video/pipewire/files/pipewire-0.3.39-endian-test-fix.patch @@ -1,4 +1,5 @@ https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/5dfc3494dc4635918e74b9f3d717a39a74b28554.patch +https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/c07f0ccb71a9d95944ce3e4d7e453cb50a26b0a2.patch From 5dfc3494dc4635918e74b9f3d717a39a74b28554 Mon Sep 17 00:00:00 2001 From: Wim Taymans @@ -29,3 +30,83 @@ index f47dfa6b3..1867fa4d3 100644 -- GitLab +From c07f0ccb71a9d95944ce3e4d7e453cb50a26b0a2 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Mon, 25 Oct 2021 16:11:56 +0200 +Subject: [PATCH] map: make _insert_at() fail on a removed item + +You are only supposed to use _insert_new()/_remove() or _insert_at() +on the map, If we detect a _insert_at() to a removed item, +return an error because else we might corrupt the free list. + +Update unit test accordingly. +--- + src/pipewire/map.h | 15 ++------------- + test/test-map.c | 17 +---------------- + 2 files changed, 3 insertions(+), 29 deletions(-) + +diff --git a/src/pipewire/map.h b/src/pipewire/map.h +index fd57f7f7c..f47dfa6b3 100644 +--- a/src/pipewire/map.h ++++ b/src/pipewire/map.h +@@ -182,20 +182,9 @@ static inline int pw_map_insert_at(struct pw_map *map, uint32_t id, void *data) + if (item == NULL) + return -errno; + } else { +- if (pw_map_id_is_free(map, id)) { +- uint32_t *current = &map->free_list; +- while (*current != SPA_ID_INVALID) { +- uint32_t current_id = (*current) >> 1; +- uint32_t *next = &pw_map_get_item(map, current_id)->next; +- +- if (current_id == id) { +- *current = *next; +- break; +- } +- current = next; +- } +- } + item = pw_map_get_item(map, id); ++ if (pw_map_item_is_free(item)) ++ return -EINVAL; + } + item->data = data; + return 0; +diff --git a/test/test-map.c b/test/test-map.c +index dd1df77a8..b6d7681ce 100644 +--- a/test/test-map.c ++++ b/test/test-map.c +@@ -188,7 +188,6 @@ PWTEST(map_insert_at_free) + int data[3] = {1, 2, 3}; + int new_data = 4; + int *ptr[3] = {&data[0], &data[1], &data[3]}; +- int *new_ptr = &new_data; + int idx[3]; + int rc; + +@@ -225,21 +224,7 @@ PWTEST(map_insert_at_free) + } + + rc = pw_map_insert_at(&map, item_idx, &new_data); +- pwtest_neg_errno_ok(rc); +- pwtest_ptr_eq(new_ptr, pw_map_lookup(&map, item_idx)); +- +- if (before_idx != SKIP && before_idx != item_idx) { +- rc = pw_map_insert_at(&map, before_idx, &ptr[before_idx]); +- pwtest_neg_errno_ok(rc); +- pwtest_ptr_eq(&ptr[before_idx], pw_map_lookup(&map, before_idx)); +- } +- +- if (after_idx != SKIP && after_idx != item_idx) { +- rc = pw_map_insert_at(&map, after_idx, &ptr[after_idx]); +- pwtest_neg_errno_ok(rc); +- pwtest_ptr_eq(&ptr[after_idx], pw_map_lookup(&map, after_idx)); +- } +- ++ pwtest_neg_errno(rc, -EINVAL); + pw_map_clear(&map); + + return PWTEST_PASS; +-- +GitLab +