mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Repro code (example_null; asan error) (!this commit should be ignored when merging!)
This commit is contained in:
parent
d71091a957
commit
ea578fb36d
2 changed files with 22 additions and 4 deletions
|
|
@ -27,27 +27,29 @@
|
|||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<EnableASAN>true</EnableASAN>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<EnableASAN>true</EnableASAN>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue