mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-04-03 07:15:42 -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;
|
||||
size_t count;
|
||||
|
||||
start = (union map_entry *) entries->data;
|
||||
count = entries->size / sizeof(union map_entry);
|
||||
for (size_t idx = 0; ; idx++) {
|
||||
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];
|
||||
if (entry.data && !map_entry_is_free(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