Various UB warnings found by UBSan
オープン
まだ誰も着手していません。
extension-modules
interpreter-core
type-bug
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
These were all found by UBSan in our CI (it just hasn't been complaining about them). They need to be individually checked, some may be false positives.
# Objects/object.c:97:5: runtime error: member access within null pointer of type 'PyThreadState' (aka 'struct _ts')
null:Objects/object.c
In test_memoryview:
# Objects/memoryobject.c:3032:15: runtime error: load of value 2, which is not a valid value for type 'bool'
bool:Objects/memoryobject.c
In test_ctypes:
# Modules/_ctypes/cfield.c:644:1: runtime error: left shift of 1 by 63 places cannot be represented in type 'int64_t' (aka 'long')
shift-base:Modules/_ctypes/cfield.c
# Modules/_ctypes/cfield.c:640:1: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
signed-integer-overflow:Modules/_ctypes/cfield.c
In test_zstd:
# Modules/_zstd/decompressor.c:598:56: runtime error: applying non-zero offset 18446744073709551615 to null pointer
pointer-overflow:Modules/_zstd/decompressor.c
# Modules/_io/stringio.c:350:24: runtime error: addition of unsigned offset to 0x7fd01ec25850 overflowed to 0x7fd01ec2584c
pointer-overflow:Modules/_io/stringio.c
# Objects/bytesobject.c:1190:25: runtime error: applying zero offset to null pointer
pointer-overflow:Objects/bytesobject.c
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
- gh-151274
- gh-148168
- gh-153187
- gh-153204
- gh-153258
- gh-153644
- gh-153645
- gh-154912
- gh-154913
- gh-154915
- gh-154926
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず UBSan のレポートと、Objects/object.c、Objects/memoryobject.c、Modules/_ctypes/cfield.c、Modules/_zstd/decompressor.c、Modules/_io/stringio.c、Objects/bytesobject.c にある指定された箇所を確認します。関連する UBSan CI テストを実行し、その後、どの警告が妥当でどれが誤検知なのかを判断し、それぞれに対処済みであることを確認します。リンクされた PR は、作業がすでに進行中であることを示しています。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c
- 領域
- testing-qa
- issue の種類
- バグ
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 15/100