Skip to content

Commit fcd84b9

Browse files
committed
Fix hashset memory corruption
1 parent db68c57 commit fcd84b9

1 file changed

Lines changed: 5 additions & 16 deletions

File tree

interface/core/containers/hashset.h

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,23 +1687,12 @@ namespace hud
16871687
// If the hashmap is empty, slot_ptr is nullptr, we don't want to decrement the pointer in the case
16881688
// In a non constant expression slot_ptr is located after control in the same memory layout,
16891689
// we can safely decrement as soon as we don't read the value
1690-
if (hud::is_constant_evaluated())
1691-
{
1692-
// Iterate over cloned control bytes
1693-
for (u32 full_index : group.mask_of_full_slot())
1694-
{
1695-
callback(control_ptr + (full_index - 1), slot_ptr + (full_index - 1));
1696-
}
1697-
}
1698-
else
1690+
1691+
// Iterate over cloned control bytes
1692+
for (u32 full_index : group.mask_of_full_slot())
16991693
{
1700-
--control_ptr;
1701-
--slot_ptr;
1702-
// Iterate over cloned control bytes
1703-
for (u32 full_index : group.mask_of_full_slot())
1704-
{
1705-
callback(control_ptr + full_index, slot_ptr + full_index);
1706-
}
1694+
u32 real_index = (full_index - 1);
1695+
callback(control_ptr + real_index, slot_ptr + real_index);
17071696
}
17081697
}
17091698
else

0 commit comments

Comments
 (0)