Skip to content

Assertion failure for socket with too large default timeout (larger than INT_MAX) #126876

Closed
@devdanzin

Description

@devdanzin

Crash report

What happened?

A debug build will abort when calling socket._fallback_socketpair() after a call to socket.setdefaulttimeout with too high a value:

python -c "import socket; socket.setdefaulttimeout(2**31) ; socket._fallback_socketpair()"
python: ./Modules/socketmodule.c:819: internal_select: Assertion `ms <= INT_MAX' failed.
Aborted (core dumped)

Found using fusil by @vstinner.

CPython versions tested on:

3.12, 3.13, 3.14, CPython main branch

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.13.0+ (heads/3.13:7be8743, Nov 15 2024, 15:20:16) [GCC 13.2.0]

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesextension-modulesC modules in the Modules dirtype-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