MultiSelect: fixed ImGuiSelectionBasicStorage::GetNextSelectedItem() reading past the end of storage when trailing items are unselected (#9604)

This commit is contained in:
MilosLord 2026-10-30 11:56:02 +01:00 committed by ocornut
parent f88ec043af
commit a13badd73e
2 changed files with 4 additions and 1 deletions

View File

@ -90,6 +90,9 @@ Other Changes:
- Fixed selectable highlight straying off the X2/Y2 clipping limit.
- Fixed parent window work rectangle affecting the Y2 clipping limit.
- Fixed the Y2 clipping limit overlapping bottom outer border.
- Multi-Select:
- Fixed `ImGuiSelectionBasicStorage::GetNextSelectedItem()` reading one past the
end of storage when trailing items are unselected (#9604) [@MilosLord]
- ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro
adds an extra `operator=` to ImVec2. This isn't supported but should not
be needed as you should have a constructor to convert from your type to ImVec2.

View File

@ -8803,7 +8803,7 @@ bool ImGuiSelectionBasicStorage::GetNextSelectedItem(void** opaque_it, ImGuiID*
it = _Storage.Data.Data;
IM_ASSERT(it >= _Storage.Data.Data && it <= it_end);
if (it != it_end)
while (it->val_i == 0 && it < it_end)
while (it < it_end && it->val_i == 0)
it++;
const bool has_more = (it != it_end);
*opaque_it = has_more ? (void**)(it + 1) : (void**)(it);