diff options
author | Neil <nyamatongwe@gmail.com> | 2023-08-24 08:39:28 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2023-08-24 08:39:28 +1000 |
commit | 5e2c44ecb87b123d0d8e8cf10c3474c8d98f02fd (patch) | |
tree | 67122fb5f468302f4d1e920c6babcb0e588826b5 | |
parent | 22deb7abf87dc164084eb4a618ea1ec8091689c6 (diff) | |
download | scintilla-mirror-5e2c44ecb87b123d0d8e8cf10c3474c8d98f02fd.tar.gz |
Fix potential crash when using IME with large amount of text selected.
Allows for extra NUL terminator in allocation.
-rw-r--r-- | doc/ScintillaHistory.html | 3 | ||||
-rw-r--r-- | qt/ScintillaEditBase/ScintillaEditBase.cpp | 2 |
2 files changed, 4 insertions, 1 deletions
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. <a href="https://sourceforge.net/p/scintilla/bugs/2395/">Bug #2395</a>. </li> + <li> + For Qt, fix potential crash when using IME with large amount of text selected. + </li> </ul> <h3> <a href="https://www.scintilla.org/scintilla536.zip">Release 5.3.6</a> 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<char,1024> buffer(send(SCI_GETSELTEXT)); + QVarLengthArray<char,1024> buffer(send(SCI_GETSELTEXT)+1); sends(SCI_GETSELTEXT, 0, buffer.data()); return sqt->StringFromDocument(buffer.constData()); |