Skip to content

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

@StanFromIreland

Description

@StanFromIreland

Crash report

What happened?

Added in 1e34da4, we assert that:

assert(res == PyObject_RichCompareBool(v, w, Py_LT));

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    easyinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions