PY_SSIZE_T_MIN negate UB in unicode_format.c and bytesobject.c
未關閉
還沒有人認領這個 Issue。
interpreter-core
type-bug
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Bug report
Bug description:
Original gist: https://gist.github.com/devdanzin/577421b083bad6802aa391b909d1a725
unicode_format_arg_parse (line 563): -PY_SSIZE_T_MIN is undefined behavior in C. Benign on two's-complement but technically UB. bytesobjects.c have the same problem.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
- gh-151849
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
先閱讀 unicode_format_arg_parse(位於 unicode_format.c)以及 bytesobject.c 中對應的程式碼,然後檢查涵蓋格式化的現有測試。完成的標準是:在不產生未定義行為的情況下處理報告中的兩個 PY_SSIZE_T_MIN 取反問題,並且相關的 CPython 測試通過。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- c, python
- 領域
- backend
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 35/100