[Bug]: TUI word wrap, LaTeX parsing, and bracketed paste can run without a bound

Aperta
#613 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
1/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
cli, testing

Direzione di ricerca

The linked fix branch already contains changes for wordWrapLine, LaTeX parsing, and paste limits in StdinBuffer, Input, and Editor, with focused tests under packages/tui/test/unit/. Read the commits from 203278f through b1bfc9a and compare them with 3c21163; the issue says the targeted Vitest run passes 21 tests. Work is already under way, and the report says external pull requests are not accepted.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

Three interactive TUI paths can run without a bound and take down the client. External pull requests are not accepted from this account. The fix branch is linked below.

Searched existing issues first. #32 is a LaTeX display question, and #491 is a clipboard-paste contribution question. Neither is this recursion or buffer bound.

Product or interface

CLI - interactive TUI. Source build.

Version

Source main at 3c21163 (chore(sdk-python): release 0.1.1). Node.js v24.19.0. pnpm 9.12.0.

Platform

Windows 11 Pro, build 26200.

Issue area

UI / UX.

Steps to reproduce

On 3c21163:

  1. Word wrap: render a line that contains one wide grapheme, such as a CJK character or an emoji, with wordWrapLine when the terminal content width is 1 column.
  2. LaTeX: call renderLatex with a few hundred unmatched { characters, or with environments nested a few hundred levels deep.
  3. Paste: send a bracketed-paste start (ESC [200~) and keep sending data with no end marker until the buffer passes 1 MiB. The same buffer exists in StdinBuffer, Input, and Editor.

Expected and actual behavior

  • Expected: a single wide grapheme is emitted as its own visual chunk; LaTeX deeper than a small fixed depth is treated as unsupported; an oversized or unterminated paste is dropped and the input path accepts later keystrokes.
  • Actual: wordWrapLine recurses on that same grapheme until the stack overflows; renderLatex recurses once per nested group or environment until the stack overflows; the paste buffer grows for as long as the end marker is absent.

Branch

https://github.com/Coff0xc/minimax-code/tree/fix/code-defects

Head b1bfc9a. Commits from 203278f through b1bfc9a, based on 3c21163.

  • wordWrapLine recurses only when a segment contains more than one grapheme.
  • LaTeX parsing shares a depth of 64 across nested braces and nested environment parsers.
  • StdinBuffer, Input, and Editor drop a bracketed paste larger than 1 MiB and leave paste mode.

Validation

Windows, Node.js v24.19.0, Vitest 4.1.11, on the committed sources:

npx --yes [email protected] exec vitest run --config vitest.oss.config.mjs packages/tui/test/unit/tui-word-wrap-wide-grapheme.test.ts packages/tui/test/unit/tui-latex-parse-depth.test.ts packages/tui/test/unit/tui-terminal-text-paste.test.ts

21 passed: word wrap 5, LaTeX depth 3, paste 13.

NOT RUN: pnpm verify, and Linux or macOS CI. The paste cap was exercised with synthetic input, not a physical terminal paste.

Checklist

  • I have searched existing issues.
  • I have included the version and removed sensitive information.
Lingua principale
TypeScript
Stelle
2.3k
Fork
315
Merge medio
3h 54m
PR unite (30g)
9

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MiniMax-AI/minimax-code

Tutte le issue di MiniMax-AI/minimax-code

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.