Applying a patch with a fuzzFactor can be very very slow

未关闭
#692 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@json-open-source 已经在做这个了。

开始于 2026年10月1日。

  • #711 来自 @json-open-source —— 未关闭
  • #716 来自 @anzal1 —— 未关闭

评估

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

调研方向

从 applyPatch(...) 和 applyPatches(...) 入口点开始,跟踪报告中描述的模糊补丁匹配逻辑。复现对照用例和构造的 high-fuzzFactor 用例,以测量性能下降。完成的标准是,构造的模糊补丁不再触发过高的 CPU 时间,同时正常的模糊应用行为保持不变。

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

描述

performance

Thanks to the following five security researchers for reporting this:

Finding 1: Fuzzy patch application can cause algorithmic complexity DoS
Affected behavior

applyPatch and applyPatches support fuzzy patch matching. With crafted hunks and a high fuzzFactor, the matching logic can end up exploring many alternatives recursively and spend a large amount of CPU time on a single input.

Affected entrypoints

`applyPatch(...)`
`applyPatches(...)`

Reproduction notes
In our reproduction, a normal control case completed in under 1 ms, while a crafted fuzzy patch took about 7.7 seconds on the same setup:

control time: 0.568181 ms
exploit time: 7737.472789 ms
slowdown: 13617.9717x

The issue appears to come from recursive branch exploration in the fuzzy patch application logic.

主要语言
JavaScript
星标
9.2k
派生
555
平均合并
1 天 9 小时
30 天内合并 PR
5

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

kpdecker/jsdiff 的其他 Issue

查看 kpdecker/jsdiff 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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