mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Debug Tools: fixed DebugTextEncoding() potentially reading out of bounds if provided a trailing truncated UTF-8 sequence.
This commit is contained in:
parent
2a194e21a0
commit
8df962a6ed
4 changed files with 14 additions and 7 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue