From b4c11c7cc56c18ebe14319b3389ff13c625e99d7 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Wed, 9 Dec 2015 16:20:27 +0300 Subject: QComposeInputContext: reduce composeBuffer to QT_KEYSEQUENCE_MAX_LEN The extra length has been used for a sentinel null value. By checking the index before indexing into the array, that extra element can be dropped. Change-Id: I0b309420d8d89f75e2381a8065c8e68a1a33427c Reviewed-by: Marc Mutz Reviewed-by: Lars Knoll --- .../platforminputcontexts/compose/qcomposeplatforminputcontext.cpp | 2 +- .../platforminputcontexts/compose/qcomposeplatforminputcontext.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforminputcontexts/compose') diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp index d1bea9af23..58c91eca9f 100644 --- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp @@ -111,7 +111,7 @@ bool QComposeInputContext::filterEvent(const QEvent *event) keysym = keyEvent->nativeVirtualKey(); int nCompose = 0; - while (m_composeBuffer[nCompose] != 0 && nCompose < QT_KEYSEQUENCE_MAX_LEN) + while (nCompose < QT_KEYSEQUENCE_MAX_LEN && m_composeBuffer[nCompose] != 0) nCompose++; if (nCompose == QT_KEYSEQUENCE_MAX_LEN) { diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h index bdf5a91335..898eafd786 100644 --- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h +++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h @@ -68,7 +68,7 @@ protected: private: QObject *m_focusObject; QVector m_composeTable; - uint m_composeBuffer[QT_KEYSEQUENCE_MAX_LEN + 1]; + uint m_composeBuffer[QT_KEYSEQUENCE_MAX_LEN]; TableGenerator::TableState m_tableState; bool m_compositionTableInitialized; }; -- cgit v1.2.3