InputText: fixed a buffer overrun that could happen when using dynamically resizing buffers. (#8689)
build / Windows (push) Has been cancelled
build / Linux (push) Has been cancelled
build / MacOS (push) Has been cancelled
build / iOS (push) Has been cancelled
build / Emscripten (push) Has been cancelled
build / Android (push) Has been cancelled
scheduled / scheduled (push) Has been cancelled

This commit is contained in:
ocornut
2025-06-17 20:11:22 +02:00
parent 12626b85c4
commit b2c73596ae
3 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -4289,7 +4289,7 @@ void ImGuiInputTextCallbackData::InsertChars(int pos, const char* new_text, cons
// Grow internal buffer if needed
const bool is_resizable = (Flags & ImGuiInputTextFlags_CallbackResize) != 0;
const int new_text_len = new_text_end ? (int)(new_text_end - new_text) : (int)ImStrlen(new_text);
if (new_text_len + BufTextLen >= BufSize)
if (new_text_len + BufTextLen + 1 > obj->TextA.Size)
{
if (!is_resizable)
return;