1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

Scrollbar: fixed a codepath leading to a divide-by-zero. (#9089)

This commit is contained in:
ocornut 2025-11-24 14:27:03 +01:00
parent 324cea1f41
commit 136d067eed
2 changed files with 5 additions and 0 deletions

View file

@ -43,6 +43,9 @@ Breaking Changes:
Other Changes:
- Scrollbar: fixed a codepath leading to a divide-by-zero (which would not be
noticeable by user but detected by sanitizers). (#9089) [@judicaelclair]
-----------------------------------------------------------------------
VERSION 1.92.5 (Released 2025-11-20)

View file

@ -1037,6 +1037,8 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6
// V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)
const float scrollbar_size_v = (axis == ImGuiAxis_X) ? bb.GetWidth() : bb.GetHeight();
if (scrollbar_size_v < 1.0f)
return false;
// Calculate the height of our grabbable box. It generally represent the amount visible (vs the total scrollable amount)
// But we maintain a minimum size in pixel to allow for the user to still aim inside.