From 5e2c44ecb87b123d0d8e8cf10c3474c8d98f02fd Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 24 Aug 2023 08:39:28 +1000 Subject: Fix potential crash when using IME with large amount of text selected. Allows for extra NUL terminator in allocation. --- doc/ScintillaHistory.html | 3 +++ qt/ScintillaEditBase/ScintillaEditBase.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 51303feec..c32dfdb5b 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -593,6 +593,9 @@ For Qt, allow parent window to handle context menu events by setting as ignored. Bug #2395. +
  • + For Qt, fix potential crash when using IME with large amount of text selected. +
  • Release 5.3.6 diff --git a/qt/ScintillaEditBase/ScintillaEditBase.cpp b/qt/ScintillaEditBase/ScintillaEditBase.cpp index 8a1355e53..d18a5da29 100644 --- a/qt/ScintillaEditBase/ScintillaEditBase.cpp +++ b/qt/ScintillaEditBase/ScintillaEditBase.cpp @@ -674,7 +674,7 @@ QVariant ScintillaEditBase::inputMethodQuery(Qt::InputMethodQuery query) const case Qt::ImCurrentSelection: { - QVarLengthArray buffer(send(SCI_GETSELTEXT)); + QVarLengthArray buffer(send(SCI_GETSELTEXT)+1); sends(SCI_GETSELTEXT, 0, buffer.data()); return sqt->StringFromDocument(buffer.constData()); -- cgit v1.2.3