Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Unchecked signed integer overflow in PyLong_AsPid() #117021

Closed
Labels
3.11only security fixes3.12only security fixes3.13bugs and security fixestopic-C-API
@serhiy-storchaka

Description

@serhiy-storchaka

Ifpid_t has the same size asint,PyLong_AsPid is defined asPyLong_AsLong. if the size ofint is less than the size oflong, there are values out of the Cint range but in the Clong range. CallingPyLong_AsPid() with such argument will not raise an exception, but casting the result out of the Cint range topid_t has undefined behavior.

Most non-Windows 64-bit platforms are affected.

The simplest solution is to definePyLong_AsPid asPyLong_AsInt. It only applicable in 3.13, becausePyLong_AsInt is new in 3.13. In older versions there is_PyLong_AsInt, but it is declared inInclude/cpython/longobject.h, not inInclude/longobject.h.

cc@vstinner,@pitrou

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixes3.13bugs and security fixestopic-C-API

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp