Crash in `create_elementiter` when OOM
未关闭
还没有人认领这个 Issue。
extension-modules
topic-XML
type-crash
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Crash report
What happened?
import _testcapi
from xml.etree.ElementTree import Element
e = Element('root')
_testcapi.set_nomemory(1, 2)
try:
e.iter()
except MemoryError:
pass
finally:
_testcapi.remove_mem_hooks()
With UBSan enabled, I get:
Modules/_elementtree.c:2176:9: runtime error: applying non-zero offset 15914838024376868032 to null pointer
Segmentation fault (core dumped)
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Output from running 'python -VV' on the command line:
No response
Linked PRs
- gh-148838
- gh-152120
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Modules/_elementtree.c 中的 create_elementiter 附近开始,并在 UBSan 下使用 _testcapi.set_nomemory 重现报告的 e.iter() 情况。检查相关的 PR gh-148838 和 gh-152120;当内存不足路径不再触发空指针偏移诊断或段错误时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, python
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100