`_remote_debugging`: `BinaryWriter.write_sample()` trivial segfault
未关闭
还没有人认领这个 Issue。
extension-modules
topic-profiling
type-bug
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Bug description:
[139] 2026-09-09T18:57:09.249268000+0200 maurycy@gimel /Users/maurycy/work/cpython (main 52ffffe) % ./python.exe
Python 3.16.0a0 (heads/main:83dbe6ae9f4, Sep 6 2026, 18:18:16) [Clang 21.0.0 (clang-2100.1.1.101)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import _remote_debugging
>>> _remote_debugging.BinaryWriter("/tmp/o.bin", 1000, 1000000).write_sample([42], 2000)
zsh: segmentation fault ./python.exe
There's many more variants, easy to come up with.
This is the place:
It only checks if it's a list, and then it trusts completely:
The comment says Use unchecked accessors since we control the data structures but I still think that segmentation fault on a public method is not great.
I will submit a PR soon.
ref #148178
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
- gh-157228
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Modules/_remote_debugging/binary_io_writer.c 中的 BinaryWriter.write_sample() 以及所引用的 unchecked-accessor 位置开始。使用提供的 BinaryWriter(...).write_sample([42], 2000) 调用重现崩溃,然后验证无效的公共输入不再导致 segfault,并且该行为已由适当的回归测试覆盖。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, python
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 25/100