mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-04-06 07:15:47 -04:00
Merge branch 'fix-crash' into 'main'
util: fix use-after-free in for_each_helper See merge request wayland/wayland!536
This commit is contained in:
commit
6016a04473
1 changed files with 5 additions and 3 deletions
|
|
@ -424,10 +424,12 @@ for_each_helper(struct wl_array *entries, wl_iterator_func_t func, void *data)
|
||||||
union map_entry entry, *start;
|
union map_entry entry, *start;
|
||||||
size_t count;
|
size_t count;
|
||||||
|
|
||||||
start = (union map_entry *) entries->data;
|
for (size_t idx = 0; ; idx++) {
|
||||||
count = entries->size / sizeof(union map_entry);
|
count = entries->size / sizeof(union map_entry);
|
||||||
|
if (idx >= count)
|
||||||
|
break;
|
||||||
|
|
||||||
for (size_t idx = 0; idx < count; idx++) {
|
start = (union map_entry *) entries->data;
|
||||||
entry = start[idx];
|
entry = start[idx];
|
||||||
if (entry.data && !map_entry_is_free(entry)) {
|
if (entry.data && !map_entry_is_free(entry)) {
|
||||||
ret = func(map_entry_get_data(entry), data, map_entry_get_flags(entry));
|
ret = func(map_entry_get_data(entry), data, map_entry_get_flags(entry));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue