1 |
commit: 30bd9772a9ab6da8a9c0d6875fd08322d89cada1 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Oct 26 15:01:38 2021 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Oct 26 15:02:09 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30bd9772 |
7 |
|
8 |
media-video/pipewire: add another upstream patch to fix build failure |
9 |
|
10 |
Closes: https://bugs.gentoo.org/820365 |
11 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
12 |
|
13 |
.../files/pipewire-0.3.39-endian-test-fix.patch | 81 ++++++++++++++++++++++ |
14 |
1 file changed, 81 insertions(+) |
15 |
|
16 |
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 |
17 |
index a8febb81491..2687299b235 100644 |
18 |
--- a/media-video/pipewire/files/pipewire-0.3.39-endian-test-fix.patch |
19 |
+++ b/media-video/pipewire/files/pipewire-0.3.39-endian-test-fix.patch |
20 |
@@ -1,4 +1,5 @@ |
21 |
https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/5dfc3494dc4635918e74b9f3d717a39a74b28554.patch |
22 |
+https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/c07f0ccb71a9d95944ce3e4d7e453cb50a26b0a2.patch |
23 |
|
24 |
From 5dfc3494dc4635918e74b9f3d717a39a74b28554 Mon Sep 17 00:00:00 2001 |
25 |
From: Wim Taymans <wtaymans@××××××.com> |
26 |
@@ -29,3 +30,83 @@ index f47dfa6b3..1867fa4d3 100644 |
27 |
-- |
28 |
GitLab |
29 |
|
30 |
+From c07f0ccb71a9d95944ce3e4d7e453cb50a26b0a2 Mon Sep 17 00:00:00 2001 |
31 |
+From: Wim Taymans <wtaymans@××××××.com> |
32 |
+Date: Mon, 25 Oct 2021 16:11:56 +0200 |
33 |
+Subject: [PATCH] map: make _insert_at() fail on a removed item |
34 |
+ |
35 |
+You are only supposed to use _insert_new()/_remove() or _insert_at() |
36 |
+on the map, If we detect a _insert_at() to a removed item, |
37 |
+return an error because else we might corrupt the free list. |
38 |
+ |
39 |
+Update unit test accordingly. |
40 |
+--- |
41 |
+ src/pipewire/map.h | 15 ++------------- |
42 |
+ test/test-map.c | 17 +---------------- |
43 |
+ 2 files changed, 3 insertions(+), 29 deletions(-) |
44 |
+ |
45 |
+diff --git a/src/pipewire/map.h b/src/pipewire/map.h |
46 |
+index fd57f7f7c..f47dfa6b3 100644 |
47 |
+--- a/src/pipewire/map.h |
48 |
++++ b/src/pipewire/map.h |
49 |
+@@ -182,20 +182,9 @@ static inline int pw_map_insert_at(struct pw_map *map, uint32_t id, void *data) |
50 |
+ if (item == NULL) |
51 |
+ return -errno; |
52 |
+ } else { |
53 |
+- if (pw_map_id_is_free(map, id)) { |
54 |
+- uint32_t *current = &map->free_list; |
55 |
+- while (*current != SPA_ID_INVALID) { |
56 |
+- uint32_t current_id = (*current) >> 1; |
57 |
+- uint32_t *next = &pw_map_get_item(map, current_id)->next; |
58 |
+- |
59 |
+- if (current_id == id) { |
60 |
+- *current = *next; |
61 |
+- break; |
62 |
+- } |
63 |
+- current = next; |
64 |
+- } |
65 |
+- } |
66 |
+ item = pw_map_get_item(map, id); |
67 |
++ if (pw_map_item_is_free(item)) |
68 |
++ return -EINVAL; |
69 |
+ } |
70 |
+ item->data = data; |
71 |
+ return 0; |
72 |
+diff --git a/test/test-map.c b/test/test-map.c |
73 |
+index dd1df77a8..b6d7681ce 100644 |
74 |
+--- a/test/test-map.c |
75 |
++++ b/test/test-map.c |
76 |
+@@ -188,7 +188,6 @@ PWTEST(map_insert_at_free) |
77 |
+ int data[3] = {1, 2, 3}; |
78 |
+ int new_data = 4; |
79 |
+ int *ptr[3] = {&data[0], &data[1], &data[3]}; |
80 |
+- int *new_ptr = &new_data; |
81 |
+ int idx[3]; |
82 |
+ int rc; |
83 |
+ |
84 |
+@@ -225,21 +224,7 @@ PWTEST(map_insert_at_free) |
85 |
+ } |
86 |
+ |
87 |
+ rc = pw_map_insert_at(&map, item_idx, &new_data); |
88 |
+- pwtest_neg_errno_ok(rc); |
89 |
+- pwtest_ptr_eq(new_ptr, pw_map_lookup(&map, item_idx)); |
90 |
+- |
91 |
+- if (before_idx != SKIP && before_idx != item_idx) { |
92 |
+- rc = pw_map_insert_at(&map, before_idx, &ptr[before_idx]); |
93 |
+- pwtest_neg_errno_ok(rc); |
94 |
+- pwtest_ptr_eq(&ptr[before_idx], pw_map_lookup(&map, before_idx)); |
95 |
+- } |
96 |
+- |
97 |
+- if (after_idx != SKIP && after_idx != item_idx) { |
98 |
+- rc = pw_map_insert_at(&map, after_idx, &ptr[after_idx]); |
99 |
+- pwtest_neg_errno_ok(rc); |
100 |
+- pwtest_ptr_eq(&ptr[after_idx], pw_map_lookup(&map, after_idx)); |
101 |
+- } |
102 |
+- |
103 |
++ pwtest_neg_errno(rc, -EINVAL); |
104 |
+ pw_map_clear(&map); |
105 |
+ |
106 |
+ return PWTEST_PASS; |
107 |
+-- |
108 |
+GitLab |
109 |
+ |