Keep next_in and avail_in in sync in bz2/lzma/zlib decompressor reset paths
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Bug description:
(This was found by Gemini, orchestrated by Dirk Mueller at SUSE)
For https://github.com/advisories/GHSA-pg25-7cx5-cvcm the "next_in" pointers were reset to NULL. However if the decompressor is reused, the "avail_in_real" counter should also be reset to "0" at this time, as if its reused again, next_in and avail_in_real might not be in sync again.
This affects
Modules/_bz2module.c
Modules/_lzmamodule.c
Modules/zlibmodule.c
For bz2, everywhere where next_in is set to NULL, avail_in_real also needs to be set to 0.
++ bzs->next_in = NULL;
should also set
bzs->avail_in_real = 0;
similar for the others.
This is largely hardening. It is not clear if these use cases exist.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
检查 Modules/_bz2module.c、Modules/_lzmamodule.c 和 Modules/zlibmodule.c 中的重置路径,找出每个将 next_in 设置为 NULL 的赋值。确认每次此类重置也会清除 avail_in_real,然后运行相关的解压器测试,并验证复用的解压器状态仍保持同步。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, python
- 领域
- backend, security
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 描述清楚
- 新手友好度
- 62/100