mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-16 01:55:35 +00:00
Debug Tools: fixed DebugTextEncoding() potentially reading out of bounds if provided a trailing truncated UTF-8 sequence.
This commit is contained in:
@@ -5151,12 +5151,13 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
{
|
||||
// Filter pasted buffer
|
||||
const int clipboard_len = (int)ImStrlen(clipboard);
|
||||
const char* clipboard_end = clipboard + clipboard_len;
|
||||
ImVector<char> clipboard_filtered;
|
||||
clipboard_filtered.reserve(clipboard_len + 1);
|
||||
for (const char* s = clipboard; *s != 0; )
|
||||
{
|
||||
unsigned int c;
|
||||
int in_len = ImTextCharFromUtf8(&c, s, NULL);
|
||||
int in_len = ImTextCharFromUtf8(&c, s, clipboard_end);
|
||||
s += in_len;
|
||||
if (!InputTextFilterCharacter(&g, &c, flags, callback, callback_user_data, true))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user