nodejs / nodejs/node

Regression Node 24.0.0+: parsing JSONL with U+2028 (line separator)/ U+2029 (paragraph separator)

未关闭
#60,606 9 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

readline repl
主要语言
JavaScript
星标
122k
派生
37.4k
平均合并
4 天 3 小时
30 天内合并 PR
272

描述

Version

node v24.0.0+

What steps will reproduce the bug?
  • Open a Node.js shell session (version 24.x or later).
  • Run JSON.parse('{"text":"Hello
World"}') (The character between “Hello” and “World” is U+2028 (line separator). You can also use U+2029 (paragraph separator) instead.)

which will return with a Uncaught SyntaxError: Unexpected token ...

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

Always

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

Note: V8's "Subsume JSON" documentation explicitly discusses making these code points processable in JavaScript string literals (https://v8.dev/features/subsume-json). Given that, this change is surprising and breaks existing production pipelines.

What do you see instead?

After upgrading to Node v24.x, JSON.parse() now throws a SyntaxError when parsing JSON text that contains literal U+2028 (line separator) or U+2029 (paragraph separator) inside a string value. The same input parsed successfully on Node v23.x. This looks like a regression or at least an undocumented behaviour change in Node/V8.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先在 Node v24 上重现 JSON.parse 示例,并与 Node v23 进行比较,重点关注 JSON 解析路径以及字符串中 literal U+2028 和 U+2029 的处理方式。issue 没有提到源文件或测试,因此请跟踪相关的 runtime 或 V8 入口点,并添加覆盖,证明输入可以成功解析,同时不改变其他 JSON 行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, nodejs
领域
backend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。