From ea578fb36dd4bf2c413b4bd093d93bc7d4dc7aa9 Mon Sep 17 00:00:00 2001
From: achabense <60953653+achabense@users.noreply.github.com>
Date: Fri, 5 Dec 2025 18:35:58 +0800
Subject: [PATCH] Repro code (example_null; asan error) (!this commit should be
ignored when merging!)
---
examples/example_null/example_null.vcxproj | 10 ++++++----
examples/example_null/main.cpp | 16 ++++++++++++++++
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/examples/example_null/example_null.vcxproj b/examples/example_null/example_null.vcxproj
index 8ef991f3f..a4ed8e0f1 100644
--- a/examples/example_null/example_null.vcxproj
+++ b/examples/example_null/example_null.vcxproj
@@ -27,27 +27,29 @@
Application
true
Unicode
- v140
+ v143
Application
true
Unicode
- v140
+ v143
+ true
Application
false
true
Unicode
- v140
+ v143
Application
false
true
Unicode
- v140
+ v143
+ true
diff --git a/examples/example_null/main.cpp b/examples/example_null/main.cpp
index eba675670..dfc2c42f6 100644
--- a/examples/example_null/main.cpp
+++ b/examples/example_null/main.cpp
@@ -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();
}