From 05b067f05c561b1993deeea84a5700805bc9c3a6 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 5 Feb 2022 20:38:53 +0000 Subject: qt5: crash entering ë with french IM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit which for me with french IM enabled on my keyboard is physically AltGr+[ (crashes here on trying to underline ¨ with a length of 2) then e. Change-Id: Id59bd84af2ab4d8403b11b1a13efb2bbdb608199 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129538 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/qt5/QtWidget.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'vcl/qt5') diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index d999ebbb7bd8..ca74b9d118f0 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -691,7 +691,15 @@ void QtWidget::inputMethodEvent(QInputMethodEvent* pEvent) if (aCharFormat.fontStrikeOut()) aETIP |= ExtTextInputAttr::RedText; for (int j = rAttr.start; j < rAttr.start + rAttr.length; j++) + { + SAL_WARN_IF(j >= static_cast(aTextAttrs.size()), "vcl.qt", + "QInputMethodEvent::Attribute out of range. Broken range: " + << rAttr.start << "," << rAttr.start + rAttr.length + << " Legal range: 0," << aTextAttrs.size()); + if (j >= static_cast(aTextAttrs.size())) + break; aTextAttrs[j] = aETIP; + } } break; } -- cgit