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

Aberta
#613 3 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
1/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
node.js, typescript
Domínio
cli, testing

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.
Linguagem predominante
TypeScript
Estrelas
2.3k
Forks
315
Merge médio
3h 54min
PRs com merge (30d)
9

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de MiniMax-AI/minimax-code

Todas as issues de MiniMax-AI/minimax-code

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.