Skip to content

Build OpenCC 1.4.2 for the out-of-bounds read fixes (GHSA-7fqq-q52p-2jjg) - #250

Merged
nervouna merged 3 commits into
mainfrom
211-opencc-1-4-2
Nov 21, 2026
Merged

nervouna merged 3 commits into
mainfrom
211-opencc-1-4-2

Conversation

@nervouna

Copy link
Copy Markdown
Owner

Summary

Fixes #211

Builds OpenCC ver.1.4.2 (025f371dc76b598d77384fbdab90c937471844d8) instead of 1.1.9, for the two out-of-bounds
reads of GHSA-7fqq-q52p-2jjg (fixed in 1.2.0). The issue left "bump now or wait for librime" open; this bumps now:
librime 1.17.0 compiles and passes against 1.4.2 unchanged, and librime master already uses it.

  • native-sources.lock.json: new OpenCC revision and archive SHA-256.
  • build-native.py: the C++14 → C++17 patch is gone (1.4.2 is C++17). OpenCC's CMake now derives its version from
    git describe, which reads this repository's tags, so Git is hidden from that configure step
    (opencc.pc reports 1.4.2).
  • schemas/opencc/STPhrases.txt, STCharacters.txt: unmodified 1.4.2 data. The files now start with # comment
    headers, which 1.4.2 parses.
  • macOS/DEPENDENCIES.md, Core/Portable/README.md, licenses.md, the source-bundle record and the Linux source
    notice name the new version and hashes. opencc/LICENSE is byte-identical, so macOS/Licenses/opencc.txt stays.

Acceptance

  1. Shipped librime.1.dylib links OpenCC ≥ 1.2.0: OpenCC is linked statically into the dylib; the build prefix
    holds opencc.pc Version: 1.4.2 and native-build.json records revision 025f371d….
  2. bash macOS/scripts/test.sh portable engine source-bundle: PASS 7 units (engine-basic, engine-options,
    engine-english, engine-context, engine-custom-phrases, source-bundle, portable), including the traditional
    (hulianwang → 互聯網) and Emoji checks. Conversion review of the data, 1.1.9 → 1.4.2:
    • STPhrases.txt: 840 phrases added, 698 removed, 279 changed (263 with a different first value). The changes
      are upstream corrections, e.g. 万里春愁直 萬裏… → 萬里…, 三复 三複 → 三復, 云溪 云溪 → 雲溪.
    • STCharacters.txt: 32 characters added, none removed, 13 gain variants; the first value changes for two
      (托 託 → 托, 硷 礆 → 硷).
      Traditional output is off by default, so default candidates are unaffected.
  3. Version records, data hashes and notices updated as listed above; PASS portable notices match the pinned sources and Cargo.lock.

Also run: bash macOS/scripts/build.sh (passes), and bash Core/Portable/performance.sh because Emoji conversion
runs through OpenCC on the key path: all limits ok (repeated-pass key p95 0.765 ms / limit 1.8, p99 0.908 / 2.3,
first-pass p99 1.143 / 2.6, max first key 7.907 / 25, startup median 117 ms, peak RSS 56 MiB).

Deviations and open issues

  • Only macOS was built locally; the Linux build (GCC, -include cstdint kept) is covered by CI.
  • To try in the app: turn on 繁体输入 and type a few phrases; Emoji suggestions should appear as before.

Delivery record

Implementer model Implementer tokens Rework rounds Dispatch to merge Defects found in review Defects found in acceptance

🤖 Generated with Claude Code

OpenCC 1.1.9, the librime 1.17.0 submodule, has two out-of-bounds reads on
malformed UTF-8 (GHSA-7fqq-q52p-2jjg), fixed in 1.2.0. Pin ver.1.4.2, the
version librime master uses, and move the vendored s2t text dictionaries
to the same revision.

OpenCC 1.4.2 already builds as C++17, so the language-standard patch goes.
Its CMake derives the version from `git describe`, which would read this
repository's tags; hide Git from that configure step.

Fixes #211

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@nervouna
nervouna enabled auto-merge November 21, 2026 08:53
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T08:55:04.436901Z 2b82b3e PR opened
🔒 Security Review ✅ Completed 2026-11-21T08:56:30.467639Z 2b82b3e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2b82b3ee56

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +23 to +24
"url": "https://codeload.github.com/BYVoid/OpenCC/tar.gz/025f371dc76b598d77384fbdab90c937471844d8",
"sha256": "8b27931630abab1136b7c3ee920e4a95e78cb84a3cab4670198172bc82104844",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Refresh the cached OpenCC archive when changing its pin

When build/portable contains the previous build, this pin change causes build-native.py to abort with Checksum mismatch: .../opencc.tar.gz: its download loop (lines 39–45) reuses an existing archive by filename without refreshing it when the locked checksum changes. This affects existing developer checkouts and CI: both .github/workflows/ci.yml and .github/workflows/macos.yml specify prefix restore-keys that can restore the old native cache despite the new exact cache key. Update archive-cache invalidation alongside this bump, for example by including the source digest in archive filenames, while retaining checksum verification of newly downloaded archives.

Useful? React with 👍 / 👎.

CI restores build/portable from the newest cache when the lock changes.
The archive of the previous pin was then kept and failed the checksum, so
a dependency bump could not build. Download the archive again when its
digest differs from the lock, and drop that dependency's CMake build
directory when its source is replaced.

Refs #211

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@nervouna

Copy link
Copy Markdown
Owner Author

CI failed with Checksum mismatch: build/portable/opencc.tar.gz: the build/portable cache restored through restore-keys still held the OpenCC 1.1.9 archive, and build-native.py kept an existing archive instead of downloading the new pin. The second commit replaces an archive whose digest differs from the lock and removes that dependency's CMake build directory when its source is replaced. Checked locally by starting from the old archives (test.sh portable passes, archive replaced) and from a stale source stamp (OpenCC rebuilt, test.sh portable engine-options passes).

Extracted headers keep their archive dates, so Ninja did not recompile
librime against the new OpenCC headers in a restored CI cache and the
link failed. Remove the install prefix and every CMake build directory
when a source is replaced. The explanation moves to the README, where
the comment lint wants it.

Refs #211

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@nervouna
nervouna merged commit 2caabef into main Nov 21, 2026
9 checks passed
@nervouna
nervouna deleted the 211-opencc-1-4-2 branch November 21, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCC 1.1.9 has out-of-bounds reads fixed in 1.2.0 (GHSA-7fqq-q52p-2jjg)

1 participant