Repository navigation
Fix out-of-bounds accesses in the replxx line editor - #126120
alexey-milovidov merged 6 commits into
Conversation
Update `replxx` with four fixes: - An incremental history search (Ctrl-S, Ctrl-T, Meta-R, and Ctrl-R in the web terminal and SSH sessions) that started on a recalled and then edited history line mapped the cursor of the edited line onto the old text of the entry, so a search that found nothing left the cursor past the end of the line. The next edit wrote out of bounds and aborted `clickhouse-client`/`clickhouse-local`; through the web terminal or an SSH PTY session, which run the editor inside the server, it aborted the server. - Ctrl-W and Meta-. passed `char32_t` code points to `isspace`, which is undefined for values above 255 and crashed on e.g. U+10FFFF. - A tab renders as 4 spaces, but the prompt was rendered in place, so a search prompt with a tab (Meta-R on a line with a tab) overflowed its buffer. - The prompt's last line position was the number of characters minus the cursor column, which is negative for a prompt with a double-width character (e.g. in the server's `display_name`), so leaving a history search read before the prompt text and aborted. The commits are on top of the current pointer, as the broader `replxx` update goes into a separate PR. Closes ClickHouse#126008 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 3 rounds, 4 findings) plus my own review (3 findings).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-48:20261015-200600 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-7:20261015-195200 |
|
Workflow [PR], commit [80ee386] Summary: ✅
AI ReviewSummaryUpdates Final VerdictStatus: ✅ Approve |
|
Merged. Update the submodule pointer to master. |
ClickHouse/replxx#50 is merged into `master` of `replxx`, and the copy of the same fixes on top of the previous pointer (ClickHouse/replxx#51) is closed. Point the submodule to the merge commit. This also brings the `master` changes that were not in the previous pointer: editing modes, `Esc` delay, prompt indentation, per-terminal state and the Meta+Up fix (ClickHouse/replxx#36, ClickHouse#43, ClickHouse#44, ClickHouse#45, ClickHouse#46, ClickHouse#47, ClickHouse#48). `04909_client_hints_history_navigation`, which the `Esc` delay broke before ClickHouse#48, passes 10/10 locally. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Done in 6491afb:
|
Moving `contrib/replxx` to `replxx` master brought in a regression from the `Esc` delay support: `read_unicode_character` called `read` only when `poll` reported `POLLIN`, so on `POLLHUP`, `POLLERR`, or `POLLNVAL` alone the uninitialized character was decoded as input. The pointer now goes to the merge of `replxx` master into the branch of ClickHouse/replxx#49, which calls `read` on any event (end of input or error ends the input, as before), and also re-reads the terminal width on refresh for embedded clients that do not receive `SIGWINCH`. Addresses review: ClickHouse#126120 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
ClickHouse/replxx#49 is merged into `master` of `replxx`. Point the submodule to the merge commit; its tree is the same as the head of the ClickHouse#49 branch used before, so the code does not change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - 4dbd411Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261016-070011 |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units57 translation units recompiled, 231 s compile time in total, 57 of them have a recent master baseline. |
Backport #126120 to 26.10: Fix out-of-bounds accesses in the replxx line editor
Backport #126120 to 26.8: Fix out-of-bounds accesses in the replxx line editor
Backport #126120 to 26.9: Fix out-of-bounds accesses in the replxx line editor
Cherry-pick of #126120 onto 26.3. The fix moved contrib/replxx to the replxx master, which also brings unrelated features (editing modes, actions, ...). Here contrib/replxx points to bcab1537d03d (https://github.com/ClickHouse/replxx/tree/clickhouse/26.3-out-of-bounds-fixes): this branch's replxx with only the fixes cherry-picked, i.e. ClickHouse/replxx#50 and the terminal width re-read from ClickHouse/replxx#49 (its POLLHUP fix is for the Esc delay code that is not on this branch). The changelog and version_date.tsv lines that came along from a master merge on the PR branch are left out. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cherry-pick of #126120 onto 26.7. The fix moved contrib/replxx to the replxx master, which also brings unrelated features (editing modes, actions, ...). Here contrib/replxx points to 93cbc49d3fe1 (https://github.com/ClickHouse/replxx/tree/clickhouse/26.7-out-of-bounds-fixes): this branch's replxx with only the fixes cherry-picked, i.e. ClickHouse/replxx#50 and the terminal width re-read from ClickHouse/replxx#49 (its POLLHUP fix is for the Esc delay code that is not on this branch). The changelog and version_date.tsv lines that came along from a master merge on the PR branch are left out. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Backport #126120 to 26.3: Fix out-of-bounds accesses in the replxx line editor
Backport #126120 to 26.7: Fix out-of-bounds accesses in the replxx line editor
… replxx line editor
Closes: #126008
Related: ClickHouse/replxx#50
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed crashes of the interactive line editor of
clickhouse-clientandclickhouse-local, which also crashed the server when used through the web terminal or an SSH session: after a history search that found nothing on an edited recalled query, when the prompt or the line given to an Alt-R history search contained a tab, when leaving a history search with a double-width character in the prompt (for example in the server'sdisplay_name), and on Ctrl-W or Alt-. after some non-ASCII characters. Closes #126008.Description
The web terminal and SSH endpoint run the client's
replxxline editor inside the server, so input that crashes the editor kills the server (#126008). Four defects were reachable:isspace, which is undefined above 255 (SIGSEGV on U+10FFFF).--promptwith one) overflowed the buffer.display_nameof日本), so leaving a history search read before the prompt text.The submodule moves to
replxxmaster, where ClickHouse/replxx#50 merged these fixes and ClickHouse/replxx#49 fixes a decode of an uninitialized byte onPOLLHUPwithoutPOLLINintroduced by theEscdelay support. It also brings ClickHouse/replxx#36 and #43-#48.Related: ClickHouse/replxx#49
Category. On 26.3.42.3 and 26.8.18.2,
clickhouse-localaborts on Ctrl-P, an edit, a Ctrl-S search finding nothing and a key; on Alt-R after pasting a query with a tab; and on leaving a Ctrl-T search with a double-width character in the prompt.Validation.
05401_client_history_search_crash(a case per defect) passes 50/50, failing on master and without fix 4. Issue's web terminal reproducer: master died within 3-14 attempts, the fix survived 300 withdisplay_name日本. Random keys inclickhouse-local: master 74 aborts in 15 minutes, the fix 0 in 10. Withreplxxmaster: the test 50/50,04909_client_hints_history_navigation10/10, the web terminal survived 150 random frames.Workflow [PR]
Sync PR [sync-upstream/pr/126120]
Version info
26.11.1.154-master(included in26.11and later)26.10.2.13,26.9.22.3,26.8.31.2,26.7.35.6,26.3.57.4