1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-12 00:14:20 +00:00

Repro code (example_null; asan error) (!this commit should be ignored when merging!)

This commit is contained in:
achabense 2025-12-05 18:35:58 +08:00
parent d71091a957
commit ea578fb36d
2 changed files with 22 additions and 4 deletions

View file

@ -9,6 +9,20 @@
#include "../../backends/imgui_impl_null.h"
#include "../../backends/imgui_impl_null.cpp"
static void repro() {
assert(ImGui::CalcTextSize("a").x == 7);
char str[]{ 'a',' ','b',' ' };
char* str_end = str + sizeof(str);
// char xx = *str_end; // asan error.
ImGui::Begin("Test");
const int wrap_len = 7 * 2;
ImGui::PushTextWrapPos(wrap_len);
ImGui::TextUnformatted(str, str_end); // asan error.
ImGui::PopTextWrapPos();
ImGui::End();
}
int main(int, char**)
{
IMGUI_CHECKVERSION();
@ -32,6 +46,8 @@ int main(int, char**)
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
ImGui::ShowDemoWindow(nullptr);
repro();
ImGui::Render();
}