A blockquote with U+2028 or U+2029 loops the parser forever
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 62/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- nodejs, typescript
- 領域
- backend
調査の方向性
The bug lives in parseBlockquote in src/parser.ts, where the two per-line regexes disagree about U+2028 and U+2029. Reproduce with renderHtml on the input '>\u2028' and check that it hangs. Done when the parser consumes the line and the input returns a blockquote, with a regression test added for both separator characters.
索引モデルが issue の本文から書いたものです。
説明
Summary
The parser gets stuck in an infinite loop when a blockquote line contains U+2028 (line separator) or U+2029 (paragraph separator).
Environment
@tanstack/markdown1.0.0 (mainatd9b5ef7)- Node v26.8.1
- The bug is in the parser so every renderer is affected.
Steps to reproduce
import { renderHtml } from '@tanstack/markdown/html'
renderHtml('>x') // returns
renderHtml('>x\u2028') // loops indefinitely
renderHtml('>x\u2029') // loops indefinitely
Root cause
parseBlockquote checks each line twice:
/^ {0,3}>\s?/checks that the line starts a blockquote.>x\u2028passes./^ {0,3}>\s?(.*)$/reads the rest of the line.>x\u2028fails.
The second check fails because JavaScript treats U+2028 and U+2029 as line breaks and . does not match a line break. So (.*) stops before the character and $ cannot match.
When the second check fails the loop exits before moving to the next line. The parser returns an empty blockquote without consuming the line. Then it tries the same line again forever.
Any line that starts with > and contains one of these characters triggers the bug. One exception: >\u2028x works because \s? takes the character right after >.
- 主要言語
- TypeScript
- スター
- 432
- フォーク
- 11
- 平均マージ
- 57分
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/markdown のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
難易度 3/5 半日 初心者へのやさしさ 70/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
TanStack/markdown の issue をすべて見る
似ている issue
-
verified
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
anomalyco/opencode#59589 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Bug: During run init command, finish the git initialize process without question to user('Initialize a new git repository?')対応中かも @nishu-murmu が今日担当しました。 オープンpending-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
knaw-huc/textannoviz#739 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信