`unsafe_{latin,long,float}_compare` have an `assert` that assumes `PyObject_RichCompareBool` can't fail
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Objects/listobject.c at the unsafe_{latin,long,float}_compare assert and review the PyObject_RichCompareBool call documented in the report. Reproduce or inspect the OSS-Fuzz case from #444686879, then verify the relevant behavior no longer triggers an assertion when comparison returns an error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100