Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package fcitx5-unikey for openSUSE:Factory checked in at 2026-11-28 23:25:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/fcitx5-unikey (Old) and /work/SRC/openSUSE:Factory/.fcitx5-unikey.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fcitx5-unikey" Sat Nov 28 23:25:08 2026 rev:15 rq:1401256 version:5.1.13 Changes: -------- --- /work/SRC/openSUSE:Factory/fcitx5-unikey/fcitx5-unikey.changes 2026-10-22 15:50:19.660182070 +0200 +++ /work/SRC/openSUSE:Factory/.fcitx5-unikey.new.1340718/fcitx5-unikey.changes 2026-11-28 23:26:42.627214452 +0100 @@ -1,0 +2,8 @@ +Sat Nov 28 04:48:10 UTC 2026 - Marguerite Su <[email protected]> + +- Update to 5.1.13 + * Ensure enough buffer space in UkEngine::pass and restoreKeyStrokes + * Fix out-of-bounds read and invalid coda handling for a lone "z" + * Fix the wrong condition in surrounding text validation + +------------------------------------------------------------------- Old: ---- fcitx5-unikey-5.1.12.tar.zst New: ---- fcitx5-unikey-5.1.13.tar.zst ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fcitx5-unikey.spec ++++++ --- /var/tmp/diff_new_pack.QHUJ8c/_old 2026-11-28 23:26:43.275241519 +0100 +++ /var/tmp/diff_new_pack.QHUJ8c/_new 2026-11-28 23:26:43.277241602 +0100 @@ -17,7 +17,7 @@ Name: fcitx5-unikey -Version: 5.1.12 +Version: 5.1.13 Release: 0 Summary: Unikey engine support for Fcitx5 License: GPL-2.0-or-later AND LGPL-2.0-or-later @@ -26,7 +26,11 @@ BuildRequires: cmake BuildRequires: extra-cmake-modules BuildRequires: fcitx5-qt-devel +%if 0%{?suse_version} < 1699 +BuildRequires: gcc15-c++ +%else BuildRequires: gcc-c++ +%endif BuildRequires: hicolor-icon-theme BuildRequires: pkgconfig BuildRequires: qt6-base-devel @@ -50,9 +54,13 @@ %setup -q %build +%if 0%{?suse_version} < 1699 %if 0%{?suse_version} == 1500 %cmake -DCMAKE_CXX_COMPILER=%{_bindir}/g++-13 %else +%cmake -DCMAKE_CXX_COMPILER=%{_bindir}/g++-15 +%endif +%else %cmake %endif %make_build ++++++ fcitx5-unikey-5.1.12.tar.zst -> fcitx5-unikey-5.1.13.tar.zst ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-unikey-5.1.12/CMakeLists.txt new/fcitx5-unikey-5.1.13/CMakeLists.txt --- old/fcitx5-unikey-5.1.12/CMakeLists.txt 2026-09-06 04:40:04.000000000 +0200 +++ new/fcitx5-unikey-5.1.13/CMakeLists.txt 2026-11-27 20:28:28.000000000 +0100 @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.6) -project(fcitx5-unikey VERSION 5.1.12) +project(fcitx5-unikey VERSION 5.1.13) set(REQUIRED_FCITX_VERSION 5.1.13) find_package(ECM 1.0.0 REQUIRED) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-unikey-5.1.12/org.fcitx.Fcitx5.Addon.Unikey.metainfo.xml.in new/fcitx5-unikey-5.1.13/org.fcitx.Fcitx5.Addon.Unikey.metainfo.xml.in --- old/fcitx5-unikey-5.1.12/org.fcitx.Fcitx5.Addon.Unikey.metainfo.xml.in 2026-09-06 04:40:04.000000000 +0200 +++ new/fcitx5-unikey-5.1.13/org.fcitx.Fcitx5.Addon.Unikey.metainfo.xml.in 2026-11-27 20:28:28.000000000 +0100 @@ -14,6 +14,7 @@ <url type="vcs-browser">https://github.com/fcitx/fcitx5-unikey</url> <project_group>Fcitx</project_group> <releases> + <release version="5.1.13" date="2026-11-27"/> <release version="5.1.12" date="2026-09-05"/> <release version="5.1.11" date="2026-06-19"/> <release version="5.1.10" date="2026-03-17"/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-unikey-5.1.12/src/unikey-im.cpp new/fcitx5-unikey-5.1.13/src/unikey-im.cpp --- old/fcitx5-unikey-5.1.12/src/unikey-im.cpp 2026-09-06 04:40:04.000000000 +0200 +++ new/fcitx5-unikey-5.1.13/src/unikey-im.cpp 2026-11-27 20:28:28.000000000 +0100 @@ -224,7 +224,7 @@ if (length == utf8::INVALID_LENGTH) { return; } - if (cursor <= 0 && cursor > length) { + if (cursor <= 0 || cursor > length) { return; } @@ -301,7 +301,7 @@ if (length == utf8::INVALID_LENGTH) { return; } - if (cursor <= 0 && cursor > length) { + if (cursor <= 0 || cursor > length) { return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-unikey-5.1.12/test/testunikey.cpp new/fcitx5-unikey-5.1.13/test/testunikey.cpp --- old/fcitx5-unikey-5.1.12/test/testunikey.cpp 2026-09-06 04:40:04.000000000 +0200 +++ new/fcitx5-unikey-5.1.13/test/testunikey.cpp 2026-11-27 20:28:28.000000000 +0100 @@ -1891,6 +1891,30 @@ testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("e"), false); testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("Return"), false); + ic->reset(); + ic->surroundingText().setText("", 0, 0); + ic->updateSurroundingText(); + testfrontend->call<ITestFrontend::pushCommitExpectation>("á"); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("a"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("s"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("Return"), false); + + ic->reset(); + ic->surroundingText().setText("q", 0, 0); + ic->updateSurroundingText(); + testfrontend->call<ITestFrontend::pushCommitExpectation>("ủe"); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("u"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("e"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("r"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("Return"), false); + + ic->reset(); + ic->surroundingText().setText("ngả", 4, 4); + ic->updateSurroundingText(); + testfrontend->call<ITestFrontend::pushCommitExpectation>("a"); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("a"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("Return"), false); + config.setValueByPath("ModifySurroundingText", "True"); unikey->setConfig(config); @@ -1922,12 +1946,28 @@ testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("s"), false); testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("Return"), false); + ic->reset(); + ic->surroundingText().setText("nga", 0, 0); + ic->updateSurroundingText(); + testfrontend->call<ITestFrontend::pushCommitExpectation>("r"); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("r"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("Return"), false); + + ic->reset(); + ic->surroundingText().setText("ngả", 4, 4); + ic->updateSurroundingText(); + testfrontend->call<ITestFrontend::pushCommitExpectation>("s"); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("s"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("Return"), false); + instance->deactivate(); }); } void testType(Instance *instance) { instance->eventDispatcher().schedule([instance]() { + auto *unikey = instance->addonManager().addon("unikey", true); + FCITX_ASSERT(unikey); auto *testfrontend = instance->addonManager().addon("testfrontend"); auto uuid = testfrontend->call<ITestFrontend::createInputContext>("testapp"); @@ -1939,11 +1979,172 @@ testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("0"), false); testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("BackSpace"), false); + testfrontend->call<ITestFrontend::pushCommitExpectation>("f"); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("Return"), false); + + // Exercise UkEngine::pass() beyond MAX_UK_ENGINE (128) with + // Macro=False. + RawConfig config; + config.setValueByPath("InputMethod", "Telex"); + config.setValueByPath("OutputCharset", "XUTF8"); + config.setValueByPath("SpellCheck", "True"); + config.setValueByPath("AutoNonVnRestore", "True"); + config.setValueByPath("Macro", "False"); + config.setValueByPath("ModifySurroundingText", "False"); + unikey->setConfig(config); + for (int i = 0; i < 140; ++i) { + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("1"), false); + } + + // Exercise UkEngine::restoreKeyStrokes() replay when m_buffer is near + // full. + config.setValueByPath("Macro", "True"); + unikey->setConfig(config); + testfrontend->call<ITestFrontend::pushCommitExpectation>("bà "); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("b"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("a"), false); + for (int i = 0; i < 63; ++i) { + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("s"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("f"), false); + } + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("space"), false); + + testfrontend->call<ITestFrontend::pushCommitExpectation>( + std::string(110, 'x') + " "); + for (int i = 0; i < 110; ++i) { + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("x"), false); + } + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("space"), false); + + std::string expectedRestored = "ba"; + for (int i = 0; i < 10; ++i) { + expectedRestored += "sf"; + } + expectedRestored += "l "; + testfrontend->call<ITestFrontend::pushCommitExpectation>( + expectedRestored); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("b"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("a"), false); + for (int i = 0; i < 10; ++i) { + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("s"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("f"), false); + } + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("l"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("space"), false); + + // Also test direct Shift+space restoreKeyStrokes() when m_keyCurrent == + // 127. + ic->reset(); + std::string expectedShiftRestore = "ba"; + for (int i = 0; i < 63; ++i) { + expectedShiftRestore += "sf"; + } + testfrontend->call<ITestFrontend::pushCommitExpectation>( + expectedShiftRestore); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("b"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("a"), false); + for (int i = 0; i < 63; ++i) { + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("s"), false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("f"), false); + } + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("Shift+space"), + false); + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("Return"), false); FCITX_INFO() << "done"; }); } +void testInvalidConsonant(Instance *instance) { + instance->eventDispatcher().schedule([instance]() { + auto *unikey = instance->addonManager().addon("unikey", true); + FCITX_ASSERT(unikey); + auto *testfrontend = instance->addonManager().addon("testfrontend"); + auto uuid = + testfrontend->call<ITestFrontend::createInputContext>("testapp"); + auto *ic = instance->inputContextManager().findByUUID(uuid); + ic->focusIn(); + instance->setCurrentInputMethod(ic, "unikey", false); + + auto typeAndCommit = [&](std::initializer_list<const char *> keys, + const std::string &expect) { + testfrontend->call<ITestFrontend::pushCommitExpectation>(expect); + for (const char *key : keys) { + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key(key), + false); + } + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key("Return"), + false); + }; + + // Test with default config (Telex, SpellCheck=True, + // AutoNonVnRestore=True, Macro=True). + RawConfig config; + config.setValueByPath("InputMethod", "Telex"); + config.setValueByPath("OutputCharset", "XUTF8"); + config.setValueByPath("SpellCheck", "True"); + config.setValueByPath("AutoNonVnRestore", "True"); + config.setValueByPath("Macro", "True"); + config.setValueByPath("ModifySurroundingText", "False"); + unikey->setConfig(config); + + // Lone "z" at word start followed by consonants (vnw_c with cs_nil). + typeAndCommit({"z", "z"}, "zz"); + typeAndCommit({"z", "t"}, "zt"); + typeAndCommit({"z", "z", "a", "BackSpace", "z"}, "zzz"); + typeAndCommit({"z", "a", "BackSpace", "z"}, "zz"); + + // Colloquial initial "z" words and valid "dz" cluster. + typeAndCommit({"z", "o", "o"}, "zô"); + typeAndCommit({"z", "e", "e"}, "zê"); + typeAndCommit({"z", "a", "w", "c", "s"}, "zắc"); + typeAndCommit({"z", "a", "a", "y", "j"}, "zậy"); + typeAndCommit({"d", "z", "o", "o"}, "dzô"); + typeAndCommit({"d", "z", "o", "o", "s"}, "dzố"); + + // "z" is never a valid ending consonant after vowel(s). + typeAndCommit({"a", "z", "z"}, "azz"); + typeAndCommit({"b", "a", "z", "t"}, "bazt"); + typeAndCommit({"a", "z", "s"}, "azs"); + typeAndCommit({"b", "a", "z", "s"}, "bazs"); + typeAndCommit({"b", "a", "i", "z", "s"}, "baizs"); + typeAndCommit({"h", "u", "o", "w", "z"}, "huowz"); + + // "dd" enables singleMode (processNoSpellCheck), followed by "zz". + typeAndCommit({"d", "d", "z", "z"}, "đzz"); + + // Telex tone removal with "z", then another "z". + typeAndCommit({"b", "a", "s", "z"}, "ba"); + typeAndCommit({"b", "a", "s", "z", "z"}, "baz"); + + // VNI: "z" after vowel must not shift tone position or accept tone. + config.setValueByPath("InputMethod", "VNI"); + config.setValueByPath("AutoNonVnRestore", "False"); + unikey->setConfig(config); + typeAndCommit({"h", "o", "a", "1", "z"}, "hóaz"); + typeAndCommit({"h", "u", "o", "7", "z"}, "huơz"); + typeAndCommit({"b", "a", "z", "1"}, "baz1"); + + config.setValueByPath("InputMethod", "Telex"); + config.setValueByPath("AutoNonVnRestore", "True"); + // Macro=False exercises autoCommit putChar() -> engine_.pass() path. + config.setValueByPath("Macro", "False"); + unikey->setConfig(config); + testfrontend->call<ITestFrontend::pushCommitExpectation>(" "); + for (const char *key : {"z", "z", "space"}) { + testfrontend->call<ITestFrontend::keyEvent>(uuid, Key(key), false); + } + + // SpellCheck=False exercises processNoSpellCheck() resetting "z" to + // vnw_c. + config.setValueByPath("Macro", "True"); + config.setValueByPath("SpellCheck", "False"); + config.setValueByPath("AutoNonVnRestore", "False"); + unikey->setConfig(config); + typeAndCommit({"z", "z", "a", "BackSpace", "z"}, "zzz"); + }); +} + } // namespace int main() { @@ -1960,6 +2161,7 @@ setup(&instance); testBasic(&instance); testType(&instance); + testInvalidConsonant(&instance); instance.eventDispatcher().schedule([&instance]() { instance.eventDispatcher().detach(); instance.exit(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-unikey-5.1.12/unikey/ukengine.cpp new/fcitx5-unikey-5.1.13/unikey/ukengine.cpp --- old/fcitx5-unikey-5.1.12/unikey/ukengine.cpp 2026-09-06 04:40:04.000000000 +0200 +++ new/fcitx5-unikey-5.1.13/unikey/ukengine.cpp 2026-11-27 20:28:28.000000000 +0100 @@ -907,13 +907,14 @@ } bool isValidVSeq(VowelSeq v) { return v >= 0 && v < VSeqCount; } +bool isValidCSeq(ConSeq c) { return c >= 0 && c < CSeqCount; } //---------------------------------------------------------- bool isValidCV(ConSeq c, VowelSeq v) { if (c == cs_nil || v == vs_nil) return true; - if (c >= CSeqCount || v >= VSeqCount) + if (!isValidCSeq(c) || !isValidVSeq(v)) return false; VowelSeqInfo &vInfo = VSeqList[v]; @@ -946,7 +947,7 @@ if (v == vs_nil || c == cs_nil) return true; - if (v >= VSeqCount || c >= CSeqCount) + if (!isValidVSeq(v) || !isValidCSeq(c)) return false; VowelSeqInfo &vInfo = VSeqList[v]; @@ -2163,7 +2164,7 @@ c1 = m_buffer[m_current - 1 - prev.c1Offset].cseq; newCs = lookupCSeq(lowerSym); - isValid = isValidCVC(c1, newVs, newCs); + isValid = isValidCSeq(newCs) && isValidCVC(c1, newVs, newCs); if (isValid) { // check u+o -> u+o+ @@ -2224,7 +2225,10 @@ case vnw_vc: case vnw_cvc: cs = prev.cseq; - if (CSeqList[cs].len == 3) + // A lone letter that is not a consonant sequence by itself (e.g. + // "z") is stored with cs_nil, which must not be used as a table + // index. + if (!isValidCSeq(cs) || CSeqList[cs].len == 3) newCs = cs_nil; else if (CSeqList[cs].len == 2) newCs = lookupCSeq(CSeqList[cs].c[0], CSeqList[cs].c[1], lowerSym); @@ -2291,6 +2295,7 @@ //---------------------------------------------------------- void UkEngine::pass(int keyCode) { + prepareBuffer(); UkKeyEvent ev; m_pCtrl->input.keyCodeToEvent(keyCode, ev); processAppend(ev); @@ -2642,6 +2647,7 @@ m_reverted = false; m_toEscape = false; m_keyRestored = false; + m_keyRestoring = false; } //---------------------------------------------------- @@ -2667,7 +2673,8 @@ } // prepare key stroke buffer - if (m_keyCurrent > 0 && m_keyCurrent + 1 >= m_keyBufSize) { + if (!m_keyRestoring && m_keyCurrent > 0 && + m_keyCurrent + 1 >= m_keyBufSize) { // Get rid of at least half of the current entries rid = m_keyCurrent / 2; memmove(m_keyStrokes, m_keyStrokes + rid, @@ -2857,6 +2864,7 @@ } m_pCtrl->input.keyCodeToSymbol(m_keyStrokes[i].ev.keyCode, ev); m_keyStrokes[i].converted = false; + prepareBuffer(); processAppend(ev); } outSize = count;
