python / python/cpython

`unsafe_{latin,long,float}_compare` have an `assert` that assumes `PyObject_RichCompareBool` can't fail

未關閉
#148,268 6 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

easy interpreter-core type-crash
主要語言
Python
星號
77.2k
分支
36k
PR 合併指標
PR 指標待擷取

描述

Crash report

What happened?

Added in https://github.com/python/cpython/commit/1e34da49ef22004ca25c517b3f07c6d25f083ece, we assert that:
https://github.com/python/cpython/blob/eab7dbda3b7502f0a952901a80fb5e628ccd7a28/Objects/listobject.c#L2858

However, PyObject_RichCompareBool can fail and return -1 on error, triggering the assert.

Found by OSS Fuzz in #444686879.

CC @rhettinger and @tim-one

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-148309
  • gh-151820

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 Objects/listobject.c 中的 unsafe_{latin,long,float}_compare assert 開始,檢視報告中記錄的 PyObject_RichCompareBool 呼叫。重現或檢查 #444686879 中的 OSS-Fuzz case,然後驗證比較回傳錯誤時,相關行為不再觸發 assertion。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
c, python
領域
backend
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
描述清楚
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。