ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
61.02k stars 10.28k forks source link

ImGui::DebugNodeInputTextState might illegal access to memory and crash the program #8071

Closed Demonese closed 3 weeks ago

Demonese commented 3 weeks ago

Version/Branch of Dear ImGui:

Version 1.91.3, Branch: master

Back-ends:

imgui_impl_win32.cpp + imgui_impl_dx11.cpp

Compiler, OS:

Visual Studio 2022 17.11.5, Windows 11

Full config/build information:

Dear ImGui 1.91.3 (19130)
--------------------------------

sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: IMGUI_DISABLE_OBSOLETE_FUNCTIONS
define: IMGUI_DISABLE_OBSOLETE_KEYIO
define: _WIN32
define: _WIN64
define: _MSC_VER=1941
define: _MSVC_LANG=202002
--------------------------------

io.BackendPlatformName: imgui_impl_win32
io.BackendRendererName: imgui_impl_dx11
io.ConfigFlags: 0x00000003
 NavEnableKeyboard
 NavEnableGamepad
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x0000000E
 HasMouseCursors
 HasSetMousePos
 RendererHasVtxOffset
--------------------------------

io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,256
io.DisplaySize: 1258.00,744.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------

style.WindowPadding: 12.00,12.00
style.WindowBorderSize: 1.00
style.FramePadding: 6.00,4.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 12.00,6.00
style.ItemInnerSpacing: 6.00,6.00

Details:

My Issue/Question:

  1. Compile and run example_win32_directx11
  2. Open "Dear ImGui Demo" > "Tools" > "Metrics/Debugger"
  3. Click "InputText" 💥

Screenshots/Video:

image image

Minimal, Complete and Verifiable Example code:

ImGui::ShowDemoWindow();
Demonese commented 3 weeks ago

I think it's missing the initialization that causes the crash.

If I getting any TextInput focus at least once before opening TextInput debugger, everything is working fine.

ocornut commented 3 weeks ago

Thank you for reporting!

This was caused by 21d03edcb, now fixed by db26fe7