-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Description
Version/Branch of Dear ImGui:
Version 1.92.2b
Back-ends:
imgui_impl_win32.cpp + imgui_impl_dx9.cpp (and so on)
Compiler, OS:
MSVC (and so on)
Full config/build information:
No response
Details:
Line 291 in a1632c6
| #define IMGUI_DEMO_MARKER(section) do { if (GImGuiDemoMarkerCallback != NULL) GImGuiDemoMarkerCallback(__FILE__, __LINE__, section, GImGuiDemoMarkerCallbackUserData); } while (0) |
Demo marker introduces the only explicit use of __FILE__ in the imgui library. This makes users calling ShowDemoWindow() at larger risk of exposing their absolute path in the program (especially in release mode), as __FILE__ is expanded to absolute path by default. For example, I find my local path (including private username) being compiled into exe if I compile example/example_win32_directx9 (arbitrarily chosen) in release mode.
There are many ways to prevent the absolute path - there is IMGUI_DISABLE_DEMO_WINDOWS in the library, and there are compiler options to change __FILE__ to relative path (*). However, it adds more risk for users that are unaware of this problem.
Some ideas:
- Make this an opt-in block, i.e.
#ifdef-guarded by macro that's configurable in"imconfig.h", and ideally add a comment warning about__FILE__being absolute path by default, so only users that actually need this feature have to think about this. - Or replace
__FILE__with"imgui_demo.cpp"directly (I'm not familiar with the workings ofGImGuiDemoMarkerCallback, so maybe this doesn't work and is not an option.)
See also: libsdl-org/SDL#14290
(*) It's still not enough to prevent all absolute paths... I see another absolute path in the exe (the .pdb file)...