nodejs / nodejs/node

Node repl crashes when trying to call back a large multiline item

オープン
#59,431 コメント 9 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

confirmed-bug readline repl
主要言語
JavaScript
スター
122k
フォーク
37.4k
平均マージ
4日 3時間
マージ済み PR(30日)
272

説明

Version

24.4.1

Platform
Linux panta-rog 6.14.0-27-generic #27-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 17:01:58 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Subsystem

No response

What steps will reproduce the bug?

Paste a huge multi-line JSON into repl.
Then bring it back via arrow up.
Then press arrow up again.

How often does it reproduce? Is there a required condition?

I can reproduce it with a long JSON.

What is the expected behavior? Why is that the expected behavior?

No crash.

What do you see instead?
TypeError: Cannot read properties of undefined (reading 'length')
    at REPLServer.[_multilineMove] (node:internal/readline/interface:1092:36)
    at REPLServer.[_moveUpOrHistoryPrev] (node:internal/readline/interface:1149:27)
    at REPLServer.[_ttyWrite] [as _ttyWrite] (node:internal/readline/interface:1498:37)
    at REPLServer.self._ttyWrite (node:repl:1035:9)
    at ReadStream.onkeypress (node:internal/readline/interface:284:20)
    at ReadStream.emit (node:events:507:28)
    at ReadStream.emit (node:domain:489:12)
    at emitKeys (node:internal/readline/utils:371:14)
    at emitKeys.next (<anonymous>)
    at ReadStream.onData (node:internal/readline/emitKeypressEvents:64:36)
Additional information

No response

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、大きな複数行の JSON 項目を使って Node REPL でクラッシュを再現し、次に internal/readline/interface の _multilineMove と _moveUpOrHistoryPrev、および node:repl を調査します。上矢印の操作を 2 回繰り返しても、報告された TypeError が発生せず、REPL がクラッシュしなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, linux, node.js
領域
cli
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。