emilk / emilk/imgui_software_renderer
Out of bounds access in paint_uniform_rectangle
- Dominant language
- C++
- Stars
- 303
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
I put together the imgui demo containing ImGui::ShowDemoWindow() (the same imgui commit contained in third_party) with this software renderer, and had a consistent crash when opening Widgets, Color/Picker Widgets in the demo window. The Windows 10 window size was 889x528. The position and size of the demo window (as reported by imgui.ini):
[Window][ImGui Demo]
Pos=75,38
Size=691,3418
Collapsed=0
I believe I traced the issue to this line: https://github.com/emilk/imgui_software_renderer/blob/e942aca8f4352471217e0041c6c0d35f45a07fc2/src/imgui_sw.cpp#L239
max_y_i and min_y_i were both 528. That would prevent the for loops from drawing a row, but the last_target_pixel line still accessed memory beforehand. To fix, I set last_target_pixel to 0, as was done here: https://github.com/emilk/imgui_software_renderer/blob/e942aca8f4352471217e0041c6c0d35f45a07fc2/src/imgui_sw.cpp#L432
Apologies if a pull request might have been preferred. I was not sure if I should do so unsolicited.
Thanks for putting this together, it has been a massive help for a certain project of mine
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.