mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
util/bitset: Avoid dereferencing the bitset for size == 0.
If we don't have any bits in our set, don't go reading the pointer. Fixes invalid accesses caught by ASan in liveness and nir_to_tgsi when impl->ssa_alloc == 0. Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8530>
This commit is contained in:
parent
efff70e73f
commit
b183b6ddd7
1 changed files with 1 additions and 1 deletions
|
|
@ -151,7 +151,7 @@ __bitset_next_set(unsigned i, BITSET_WORD *tmp,
|
|||
* @param __size number of bits in the set to consider
|
||||
*/
|
||||
#define BITSET_FOREACH_SET(__i, __set, __size) \
|
||||
for (BITSET_WORD __tmp = *(__set), *__foo = &__tmp; __foo != NULL; __foo = NULL) \
|
||||
for (BITSET_WORD __tmp = (__size) == 0 ? 0 : *(__set), *__foo = &__tmp; __foo != NULL; __foo = NULL) \
|
||||
for (__i = 0; \
|
||||
(__i = __bitset_next_set(__i, &__tmp, __set, __size)) < __size;)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue