Commit graph

14544 commits

Author SHA1 Message Date
Ramin Farajpour Cami
b2894626aa
[3.13] gh-145623: Fix crashes on uninitialized struct.Struct objects (gh-145624) (GH-145631) 2026-03-09 17:41:45 +01:00
Miss Islington (bot)
1a73d5a35c
[3.13] gh-145376: Fix refleak in queuemodule.c out-of-memory path (GH-145543) (#145621)
gh-145376: Fix refleak in `queuemodule.c` out-of-memory path (GH-145543)
(cherry picked from commit 0aeaaafac4)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2026-03-08 13:32:39 +05:30
Pieter Eendebak
ae7206eb3b
[3.13] gh-145376: Fix crashes in md5module.c (GH-145422) (#145611)
* gh-145376: Fix crashes in md5module.c

Fix a possible NULL pointer dereference in `md5module.c`.
This can only occur in error paths taken when the interpreter fails to allocate memory.

(cherry-picked from c1d7768321)

* 📜🤖 Added by blurb_it.

* Update Modules/md5module.c

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-03-06 22:24:20 +00:00
Miss Islington (bot)
dbeb29aee3
[3.13] gh-142781: Fix type confusion in zoneinfo weak cache (GH-142925) (GH-145418)
(cherry picked from commit b611db491d)

Co-authored-by: zhong <60600792+superboy-zjc@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-03 12:47:57 +01:00
Miss Islington (bot)
fb340275c4
[3.13] gh-143880: Fix data race in functools.partial in free threading build (GH-143882) (#145435)
Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-03-02 21:31:46 +00:00
Miss Islington (bot)
d305326458
[3.13] gh-145335: Fix crash when passing -1 as fd in os.pathconf (GH-145390) (#145432)
gh-145335: Fix crash when passing -1 as fd in os.pathconf (GH-145390)
(cherry picked from commit 5c3a47b94a)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-03-02 18:32:29 +00:00
Miss Islington (bot)
cd3e9b3fd2
[3.13] gh-142787: Handle empty sqlite3 blob slices (GH-142824) (#145298)
(cherry picked from commit 06b0920f12)

Co-authored-by: A.Ibrahim <abdulrasheedibrahim47@gmail.com>
2026-02-27 01:13:08 +01:00
Stan Ulbrych
e418e3351f
[3.13] gh-88091: Fix unicodedata.decomposition() for Hangul Syllables (GH-144993) (GH-145190)
(cherry picked from commit 56c4f10d6e)
2026-02-25 00:27:40 +02:00
Miss Islington (bot)
dd355045f6
[3.13] _struct.c: Fix UB from integer overflow in prepare_s (GH-145158) (#145163)
`_struct.c`: Fix UB from integer overflow in `prepare_s` (GH-145158)

Avoid possible undefined behaviour from signed overflow in `struct` module

As discovered via oss-fuzz.
(cherry picked from commit fd0400585e)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-02-24 01:16:45 +00:00
Bénédikt Tran
0038b58ac9
[3.13] gh-143698: correctly check scheduler and setpgroup values for os.posix_spawn[p] (GH-143699) (#145074)
* [3.13] gh-143698: correctly check `scheduler` and `setpgroup` values for `os.posix_spawn[p]` (GH-143699)

Fix an issue where passing invalid arguments to `os.posix_spawn[p]` functions
raised a SystemError instead of a TypeError, and allow to explicitly use `None`
for `scheduler` and `setpgroup` as specified in the docs.

(cherry picked from commit 347fc438cf)
2026-02-21 16:05:57 +01:00
Serhiy Storchaka
e54507374b
[3.13] gh-140652: Fix a crash in _interpchannels.list_all() after clo…sing a channel (GH-143743) (GH-144953)
(cherry picked from commit 3f50432e31)
2026-02-18 14:18:39 +00:00
Peter Bierma
9314ec23a6
[3.13] gh-144601: Avoid sharing exception objects raised in a PyInit function across multiple interpreters (GH-144602) (GH-144880)
(cherry picked from commit fd6b639a49)
2026-02-16 16:05:55 +00:00
Miss Islington (bot)
ba0bab40f7
[3.13] gh-80667: Fix lookup for Tangut ideographs in unicodedata (GH-144789) (GH-144871) (GH-144875)
(cherry picked from commit 8b7b5a9946)
(cherry picked from commit bcabbd02f6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Pierre Le Marre <dev@wismill.eu>
2026-02-16 15:02:01 +00:00
Miss Islington (bot)
37f818caef
[3.13] gh-144833: Fix use-after-free in SSL module when SSL_new() fails (GH-144843) (#144859)
gh-144833: Fix use-after-free in SSL module when SSL_new() fails (GH-144843)

In newPySSLSocket(), when SSL_new() returns NULL, Py_DECREF(self)
was called before _setSSLError(get_state_ctx(self), ...), causing
a use-after-free. Additionally, get_state_ctx() was called with
self (PySSLSocket*) instead of sslctx (PySSLContext*), which is
a type confusion bug.

Fix by calling _setSSLError() before Py_DECREF() and using
sslctx instead of self for get_state_ctx().
(cherry picked from commit c91638ca06)

Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
2026-02-16 03:09:58 +00:00
Miss Islington (bot)
309bacdb4a
[3.13] gh-143637: Fix re-entrant mutation of ancillary data in socket.sendmsg() (GH-143892) (#144785)
gh-143637: Fix re-entrant mutation of ancillary data in socket.sendmsg() (GH-143892)
(cherry picked from commit 82b92e3cd1)

Co-authored-by: Priyanshu Singh <priyanshu2282@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-02-13 15:58:59 +00:00
Serhiy Storchaka
2f354107f3
[3.13] gh-80667: Fix case-sensitivity of some Unicode literal escapes (GH-107281) (GH-144754)
Lookup for CJK ideograms and Hangul syllables is now case-insensitive,
as is the case for other character names.
(cherry picked from commit e66f4a5a9c)

Co-authored-by: James <snoopjedi@gmail.com>
2026-02-12 17:18:48 +00:00
Serhiy Storchaka
009583fc6f
[3.13] gh-84424: Use numeric_changed for UCD.numeric (GH-19457) (GH-144732)
This was causing ucd_3_2_0.numeric() to pick up only decimal
changes between Unicode 3.2.0 and the current version.
(cherry picked from commit 3e0322ff16)

Co-authored-by: William Meehan <wmeehan@fb.com>
2026-02-12 08:35:09 +00:00
Miss Islington (bot)
d177460b43
[3.13] gh-143543: Fix re-entrant use-after-free in itertools.groupby (GH-143738) (GH-144627)
(cherry picked from commit a91b5c3fb5)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-02-10 14:01:23 +01:00
Miss Islington (bot)
7fbdec4180
[3.13] gh-144363: Update bundled libexpat to 2.7.4 (GH-144365) (GH-144500)
(cherry picked from commit d5cb9f6a9b)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-02-10 13:59:12 +01:00
Petr Viktorin
bad4bc4603
[3.13] gh-131261: generate_sbom.py: Exclude the refresh script from SBOM (GH-131359) (GH-144625)
- generate_sbom.py: Exclude the refresh script from SBOM
- Modules/expat/refresh.sh: Expand the list of manual steps

(cherry picked from commit 51d309988b)
2026-02-10 10:49:00 +01:00
Miss Islington (bot)
b74e3a4c05
[3.13] gh-142555: Fix null pointer dereference in array.__setitem__ via re-entrant __index__ (GH-142713) (#144397)
gh-142555: Fix null pointer dereference in array.__setitem__ via re-entrant __index__ (GH-142713)
(cherry picked from commit 39f16a93ef)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-02-02 21:06:59 +01:00
Miss Islington (bot)
51fccc6059
[3.13] gh-144380: Fix incorrect type check in buffered_iternext() (GH-144381) (#144390)
gh-144380: Fix incorrect type check in `buffered_iternext()` (GH-144381)
(cherry picked from commit 40d07cad38)

Co-authored-by: Ruiyang Ke <me@ry.ke>
2026-02-02 10:29:16 +00:00
Victor Stinner
3df9e31142
[3.13] gh-144100: Fix crash for POINTER(str) used in ctypes argtypes (#144108) (#144245)
gh-144100: Fix crash for POINTER(str) used in ctypes argtypes (#144108)


(cherry picked from commit 8f459255eb)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
2026-01-27 12:59:55 +01:00
Stan Ulbrych
837b88fd9f
[3.13] gh-144023: Prevent follow_symlinks from being allowed with an fd of 0 (GH-144022) (#144152)
[3.13] gh-144023: Prevent follow_symlinks from being allowed with an fd of 0 (GH-144022)

The check was (fd > 0), should be (fd >= 0).
(cherry picked from commit fa44efa0ef)

Co-authored-by: AZero13 <gfunni234@gmail.com>
2026-01-22 15:52:49 +00:00
Miss Islington (bot)
640ef9931e
[3.13] Update struct.__doc__: _Bool available unconditionally (GH-143716) (#144071)
Update struct.__doc__: _Bool available unconditionally (GH-143716)

This amends commit a9296e7f3b.
(cherry picked from commit 31c81ab0a2)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-01-20 12:32:45 +00:00
Miss Islington (bot)
be602fcde6
[3.13] gh-143249: Fix buffer leak when overlapped operation fails to start on windows (GH-143250) (#143796)
gh-143249: Fix buffer leak when overlapped operation fails to start on windows (GH-143250)
(cherry picked from commit 103a384bfd)

Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
2026-01-13 13:53:41 +00:00
Miss Islington (bot)
8b7ebbb432
[3.13] gh-143544: Fix possible use-after-free in the JSON decoder when JSONDecodeError disappears during raising it (GH-143561) (#143734)
gh-143544: Fix possible use-after-free in the JSON decoder when JSONDecodeError disappears during raising it (GH-143561)
(cherry picked from commit c315748060)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-01-12 16:02:23 +00:00
Sergey B Kirpichev
8fd4435cd9
[3.13] gh-78724: Raise RuntimeError's when calling methods on non-ready Struct()'s (GH-143643) (GH-143714)
(cherry picked from commit 515ae4078d)
2026-01-12 14:45:52 +02:00
Serhiy Storchaka
1822f59dc7
[3.13] gh-142881: Fix concurrent and reentrant call of atexit.unregister() (GH-142901) (GH-143722)
(cherry picked from commit dbd10a6c29)
2026-01-12 10:05:09 +00:00
Serhiy Storchaka
dcc6117628
[3.13] gh-143378: Fix use-after-free when BytesIO is concurrently mutated during write operations (GH-143408) (GH-143600)
PyObject_GetBuffer() can execute user code (e.g. via __buffer__), which may
close or otherwise mutate a BytesIO object while write() or writelines()
is in progress. This could invalidate the internal buffer and lead to a
use-after-free.

Ensure that PyObject_GetBuffer() is called before validation checks.
(cherry picked from commit 6d54b6ac7d)

Co-authored-by: zhong <60600792+superboy-zjc@users.noreply.github.com>
2026-01-12 10:37:28 +02:00
Serhiy Storchaka
e319262c4e
[3.13] gh-143638: Forbid cuncurrent use of the Pickler and Unpickler objects in C implementation (GH-143664) (GH-143687)
Previously, this could cause crash or data corruption, now concurrent calls
of methods of the same object raise RuntimeError.
(cherry picked from commit d1282efb2b)
2026-01-11 12:34:36 +00:00
Victor Stinner
43e495d6f4
[3.13] gh-142991: Fix socketmodule.c build: remove _Py_FALLTHROUGH (#143514)
Fix commit 7f936694db backport which
uses _Py_FALLTHROUGH: this macro only exists in Python 3.14 and
newer.
2026-01-07 14:17:06 +00:00
Miss Islington (bot)
7f936694db
[3.13] gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (GH-142993) (#143482)
gh-142991: socketmodule: fixed getsockaddrlen() for PF_DIVERT socket (GH-142993)
(cherry picked from commit 05406b221d)

Co-authored-by: Gleb Smirnoff <glebius@FreeBSD.org>
2026-01-06 16:48:03 +00:00
Semyon Moroz
97694de41e
[3.13] gh-143331: Schedule to remove format "N" for Decimal (GH-143372) (#143477)
(cherry picked from commit dd750b3485)
2026-01-06 14:02:32 +00:00
Bénédikt Tran
44bdb833d1
[3.13] gh-143309: fix UAF in os.execve when the environment is concurrently mutated (GH-143314) (#143431)
[3.13] gh-143309: fix UAF in `os.execve` when the environment is concurrently mutated (GH-143314) (#143431)

(cherry picked from commit 9609574e7f)
(cherry picked from commit c99f766743)
2026-01-05 19:56:02 +01:00
Miss Islington (bot)
2b8ac2c3da
[3.13] gh-143308: fix UAF when PickleBuffer is concurrently mutated in a callback (GH-143312) (#143397)
gh-143308: fix UAF when PickleBuffer is concurrently mutated in a callback (GH-143312)
(cherry picked from commit 6c53af18f6)

---------------

Co-authored-by: Aaron Wieczorek <aaronw@fastmail.com>
Co-authored-by: Aaron Wieczorek <woz@Aarons-MacBook-Pro.local>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-01-03 23:53:59 +00:00
Miss Islington (bot)
b40bf5ffc8
[3.13] gh-143310: fix crash in Tcl object conversion with concurrent mutations (GH-143321) (#143344)
gh-143310: fix crash in Tcl object conversion with concurrent mutations (GH-143321)
(cherry picked from commit 9712dc1d9e)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-01-02 10:12:57 +00:00
Bénédikt Tran
afa24d8324
[3.13] gh-142830: prevent some crashes when mutating sqlite3 callbacks (GH-143245) (#143323)
(cherry picked from commit 7f6c16a956)
2026-01-01 11:22:50 +00:00
Miss Islington (bot)
93cb42fcb9
[3.13] gh-143200: fix UAFs in Element.__{set,get}item__ when the element is concurrently mutated (GH-143226) (#143274)
gh-143200: fix UAFs in `Element.__{set,get}item__` when the element is concurrently mutated (GH-143226)
(cherry picked from commit b6b0e14b3d)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-12-29 18:15:28 +00:00
Miss Islington (bot)
5624bf9758
[3.13] gh-143145: Fix possible reference leak in ctypes _build_result() (GH-143131) (GH-143170)
The result tuple was leaked if __ctypes_from_outparam__() failed for any item.
(cherry picked from commit 579c5b496b)

Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
2025-12-25 19:09:39 +02:00
Miss Islington (bot)
4dd9d94619
[3.13] gh-143004: Fix possible use-after-free in collections.Counter.update() (GH-143044) (GH-143167)
This happened when the Counter was mutated when incrementing
the value for an existing key.
(cherry picked from commit 86d904588e)

Co-authored-by: kaushal trivedi <155625932+Kaushalt2004@users.noreply.github.com>
2025-12-25 13:41:24 +02:00
Miss Islington (bot)
a9a8ca3e47
[3.13] gh-122431: Correct the non-negative error message in readline.append_history_file (GH-143075) (GH-143091)
gh-122431: Correct the non-negative error message in `readline.append_history_file` (GH-143075)

"positive" -> "non-negative", since zero is included.
(cherry picked from commit a273bc99d2)

Co-authored-by: Zheng Yu <dataisland@outlook.com>
2025-12-23 04:59:43 +00:00
Miss Islington (bot)
98d97d76a8
[3.13] gh-143012: use Py_ssize_t cast for PyBytes_FromStringAndSize (GH-143013) (#143015)
gh-143012: use `Py_ssize_t` cast for `PyBytes_FromStringAndSize` (GH-143013)
(cherry picked from commit 5989095dfd)

Co-authored-by: AZero13 <gfunni234@gmail.com>
2025-12-20 07:59:55 +00:00
Serhiy Storchaka
08d665d607
[3.13] gh-112127: Fix possible use-after-free in atexit.unregister() (GH-114092) (GH-142880)
(cherry picked from commit 2b466c47c3)

Co-authored-by: Benjamin Johnson <ben332004@gmail.com>
2025-12-17 17:15:21 +00:00
Miss Islington (bot)
53ca3b7b5c
[3.13] Fix os.posix_spawn() error handling (GH-142532) (#142581)
Fix os.posix_spawn() error handling (GH-142532)

Consistently use `goto exit;` in `py_posix_spawn()`.
(cherry picked from commit 8cfa351560)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-12-17 15:43:51 +00:00
Miss Islington (bot)
88b8e63c54
[3.13] gh-142783: Fix possible use after free in zoneinfo module (GH-142790) (GH-142861)
(cherry picked from commit 8307a14d0e)

Co-authored-by: wangxiaolei <fatelei@gmail.com>
2025-12-17 09:21:20 +00:00
Serhiy Storchaka
9361207bc2
[3.13] gh-142495: Make defaultdict keep existed value when racing with __missing__ (GH-142668) (GH-142858)
(cherry picked from commit a043407510)

Co-authored-by: Edward Xu <xuxiangad@gmail.com>
2025-12-17 08:40:47 +00:00
Miss Islington (bot)
4480f5b661
[3.13] gh-142595: Amend be5e0dcded (fix NULL pointer dereference) (GH-142775) (GH-142789)
(cherry picked from commit 15a9762500)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-12-16 13:00:40 +02:00
Cody Maloney
affd2f2ff2
[3.13] gh-142594: fix by property calls io.TextIOWrapper.detach (GH-142706) (GH-142757)
(cherry picked from commit 1d3854a19a)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong <zouzou0208@gmail.com>
2025-12-16 10:55:35 +01:00
Miss Islington (bot)
f66684969e
[3.13] gh-142595: add type check for namedtuple call during decimal initialization (GH-142608) (GH-142622)
(cherry picked from commit be5e0dcded)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-12-15 15:04:11 +01:00