4316 Commits

Author SHA1 Message Date
Pablo Galindo Salgado 30447075e3 Post 3.11.15 2026-03-03 01:07:09 +00:00
Pablo Galindo Salgado 2340a037f7 Python 3.11.15 2026-03-03 00:52:57 +00:00
Sebastian Pipping 9bbb68a524 [3.11] gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (GH-139234) (#139529)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-25 15:25:17 +00:00
Pablo Galindo 88f3f5b5f1 Post 3.11.14 2025-10-09 19:11:08 +02:00
Pablo Galindo cd1c3a6342 Python 3.11.14 2025-10-09 18:16:55 +02:00
Pablo Galindo c79b99d1a4 Post 3.11.13 2025-06-03 20:31:21 +01:00
Pablo Galindo 498b971ea3 Python 3.11.13 2025-06-03 19:38:25 +01:00
Serhiy Storchaka 73b3040f59 [3.11] gh-133767: Fix use-after-free in the unicode-escape decoder with an error handler (GH-129648) (GH-133944) (GH-134341)
If the error handler is used, a new bytes object is created to set as
the object attribute of UnicodeDecodeError, and that bytes object then
replaces the original data. A pointer to the decoded data will became invalid
after destroying that temporary bytes object. So we need other way to return
the first invalid escape from _PyUnicode_DecodeUnicodeEscapeInternal().

_PyBytes_DecodeEscape() does not have such issue, because it does not
use the error handlers registry, but it should be changed for compatibility
with _PyUnicode_DecodeUnicodeEscapeInternal().
(cherry picked from commit 9f69a58623)
(cherry picked from commit 6279eb8c07)
(cherry picked from commit a75953b347)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-02 17:52:52 +02:00
Pablo Galindo ab47462618 Post 3.11.12 2025-04-08 16:09:30 +01:00
Pablo Galindo da1f6c61dd Python 3.11.12 2025-04-08 15:15:29 +01:00
Pablo Galindo 976c4f2a9d Post 3.11.11 2024-12-03 13:25:54 -05:00
Pablo Galindo d03b868578 Python 3.11.11 2024-12-03 12:20:40 -05:00
Pablo Galindo 8b275e77d2 Post 3.11.10 2024-09-07 02:34:11 +01:00
Pablo Galindo 0c47759eee Python 3.11.10 2024-09-07 02:03:31 +01:00
Pablo Galindo 9a40444a76 Post 3.11.9 2024-04-02 14:37:54 +01:00
Pablo Galindo de54cf5be3 Python 3.11.9 2024-04-02 09:25:04 +01:00
Serhiy Storchaka 7323c4dd07 [3.11] gh-117021: Fix integer overflow in PyLong_AsPid() on non-Windows 64-bit platforms (GH-117064) (GH-117070) (GH-117075)
(cherry picked from commit da2f9d1417)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 519b2ae22b)
2024-03-21 09:43:42 +00:00
Sebastian Pipping fc9da96274 [3.11] gh-115398: Expose Expat >=2.6.0 reparse deferral API (CVE-2023-52425) (GH-115623) (#116268)
Allow controlling Expat >=2.6.0 reparse deferral (CVE-2023-52425) by adding five new methods:

- `xml.etree.ElementTree.XMLParser.flush`
- `xml.etree.ElementTree.XMLPullParser.flush`
- `xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`
- `xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`
- `xml.sax.expatreader.ExpatParser.flush`

Based on the "flush" idea from #115138 (comment) .

- Please treat as a security fix related to CVE-2023-52425.

(cherry picked from commit 6a95676)
(cherry picked from commit 73807eb)
(cherry picked from commit eda2963)

---------

Includes code suggested-by: Snild Dolkow <snild@sony.com>
and by core dev Serhiy Storchaka.
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-03-06 14:17:02 -08:00
Pablo Galindo c43bd4b934 Post 3.11.8 2024-02-06 23:38:18 +00:00
Pablo Galindo db85d51d3e Python 3.11.8 2024-02-06 21:21:21 +00:00
Serhiy Storchaka 4b358d754c [3.11] gh-106905: Use separate structs to track recursion depth in each PyAST_mod2obj call. (GH-113035) (GH-113472) (GH-113476)
(cherry picked from commit 48c49739f5)
(cherry picked from commit d58a5f453f)

Co-authored-by: Yilei Yang <yileiyang@google.com>
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2023-12-25 20:40:33 +00:00
Pablo Galindo 4c368bc0ce Post 3.11.7 2023-12-04 21:49:55 +00:00
Pablo Galindo fa7a6f2303 Python 3.11.7 2023-12-04 17:56:29 +00:00
Lysandros Nikolaou 1af7b7db0d [3.11] gh-107450: Check for overflow in the tokenizer and fix overflow test (GH-110832) (#110939)
(cherry picked from commit a1ac5590e0)

Co-authored-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-10-18 00:34:56 +02:00
Pablo Galindo 914ffb40d0 Post 3.11.6 2023-10-02 17:23:15 +01:00
Pablo Galindo 8b6ee5ba3b Python 3.11.6 2023-10-02 14:29:10 +01:00
Victor Stinner 82a18069a1 [3.11] gh-108987: Fix _thread.start_new_thread() race condition (#109135) (#109272)
gh-108987: Fix _thread.start_new_thread() race condition (#109135)

Fix _thread.start_new_thread() race condition. If a thread is created
during Python finalization, the newly spawned thread now exits
immediately instead of trying to access freed memory and lead to a
crash.

thread_run() calls PyEval_AcquireThread() which checks if the thread
must exit. The problem was that tstate was dereferenced earlier in
_PyThreadState_Bind() which leads to a crash most of the time.

Move _PyThreadState_CheckConsistency() from thread_run() to
_PyThreadState_Bind().

(cherry picked from commit 517cd82ea7)
2023-09-11 19:33:08 +02:00
Victor Stinner b55cf2c2d8 [3.11] gh-104690: thread_run() checks for tstate dangling pointer (#109056) (#109134)
gh-104690: thread_run() checks for tstate dangling pointer (#109056)

thread_run() of _threadmodule.c now calls
_PyThreadState_CheckConsistency() to check if tstate is a dangling
pointer when Python is built in debug mode.

Rename ceval_gil.c is_tstate_valid() to
_PyThreadState_CheckConsistency() to reuse it in _threadmodule.c.

(cherry picked from commit f63d37877a)
2023-09-08 11:10:33 +00:00
Miss Islington (bot) b30c83eb21 [3.11] [3.12] gh-63760: Don't declare gethostname() on Solaris (GH-108817) (GH-108824) (#108832)
[3.12] gh-63760: Don't declare gethostname() on Solaris (GH-108817) (GH-108824)

gh-63760: Don't declare gethostname() on Solaris (GH-108817)

Since 2005, Solaris defines gethostname(). socketmodule.c no longer
has to define gethostname() for Solaris.

Oracle Solaris and OpenSolaris have patches to remove the
gethostname() definition in Python:

* https://github.com/oracle/solaris-userland/blob/master/components/python/python37/patches/15-gethostname.patch
* https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/python/python37/patches/15-gethostname.patch
* https://github.com/omniosorg/omnios-build/blob/master/build/python27/patches/24-gethostname.patch

(cherry picked from commit 7269916cd7)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
(cherry picked from commit 0e6d582b3b)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-03 08:53:02 +02:00
Pablo Galindo ea77520094 Post 3.11.5 2023-08-24 20:31:59 +01:00
Pablo Galindo cce6ba91b3 Python 3.11.5 2023-08-24 13:09:18 +01:00
Steve Dower ccf81e1088 [3.11] gh-106242: Fix path truncation in os.path.normpath (GH-106816) (#107982)
Co-authored-by: Finn Womack <flan313@gmail.com>
2023-08-15 19:07:52 +02:00
Miss Islington (bot) 2ce8e133d0 [3.11] gh-107226: PyModule_AddObjectRef() should only be in the limited API 3.10 (GH-107227) (GH-107261)
(cherry picked from commit 698b015135)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-07-25 23:02:06 +03:00
Serhiy Storchaka fced79f91e [3.11] gh-86493: Fix possible leaks in some modules initialization (GH-106768) (GH-106855) (GH-106863)
[3.11] [3.12] gh-86493: Fix possible leaks in some modules initialization (GH-106768) (GH-106855)

Fix _ssl, _stat, _testinternalcapi, _threadmodule, cmath, math, posix, time.
(cherry picked from commit 3e65baee72).
(cherry picked from commit a423ddbdea)
2023-07-19 09:40:38 +03:00
Pablo Galindo 5103df46e0 Post 3.11.4 2023-06-07 09:37:03 +01:00
Pablo Galindo d2340ef257 Python 3.11.4 2023-06-06 23:00:27 +01:00
Lysandros Nikolaou a09d3901a5 [3.11] gh-96670: Raise SyntaxError when parsing NULL bytes (GH-97594) (#104195) 2023-05-07 11:12:04 +01:00
Miss Islington (bot) 15ffcf76e1 [3.11] gh-104018: remove unused format "z" handling in string formatfloat() (GH-104107) (#104260)
gh-104018: remove unused format "z" handling in string formatfloat() (GH-104107)

This is a cleanup overlooked in PR GH-104033.
(cherry picked from commit 69621d1b09)

Co-authored-by: John Belmonte <john@neggie.net>
2023-05-07 05:06:06 +00:00
Miss Islington (bot) 851e74441e gh-99069: Consolidate checks for static_assert (GH-94766)
Several platforms don't define the static_assert macro despite having
compiler support for the _Static_assert keyword. The macro needs to be
defined since it is used unconditionally in the Python code. So it
should always be safe to define it if undefined and not in C++11 (or
later) mode.

Hence, remove the checks for particular platforms or libc versions,
and just define static_assert anytime it needs to be defined but isn't.
That way, all platforms that need the fix will get it, regardless of
whether someone specifically thought of them.

Also document that certain macOS versions are among the platforms that
need this.

The C2x draft (currently expected to become C23) makes static_assert
a keyword to match C++. So only define the macro for up to C17.

(cherry picked from commit 96e1901a59)

Co-authored-by: Joshua Root <jmr@macports.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-04-05 08:44:13 -07:00
Pablo Galindo ff844aa16e Post 3.11.3 2023-04-05 12:16:08 +01:00
Pablo Galindo f3909b8bc8 Python 3.11.3 2023-04-04 23:22:17 +01:00
Pablo Galindo e396888a6e Post 3.11.2 2023-02-08 09:55:26 +00:00
Pablo Galindo 878ead1ac1 Python 3.11.2 2023-02-07 13:37:51 +00:00
Miss Islington (bot) d2aaf818ae [3.11] gh-101037: Fix potential memory underallocation for zeros of int subtypes (GH-101038) (#101219)
gh-101037: Fix potential memory underallocation for zeros of int subtypes (GH-101038)

This PR fixes object allocation in long_subtype_new to ensure that there's at least one digit in all cases, and makes sure that the value of that digit is copied over from the source long.

Needs backport to 3.11, but not any further: the change to require at least one digit was only introduced for Python 3.11.

Fixes GH-101037.
(cherry picked from commit 401fdf9c85)

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2023-01-21 10:54:09 +00:00
Bill Fisher 57e727af3f [3.11] gh-99110: Initialize frame->previous in init_frame to fix segmentation fault (GH-100182) (#100478)
(cherry picked from commit 88d565f32a)

Co-authored-by: Bill Fisher <william.w.fisher@gmail.com>
2022-12-24 11:17:10 +05:30
Pablo Galindo fbc3e1ed90 Post 3.11.1 2022-12-06 21:07:58 +00:00
Pablo Galindo a7a450f84a Python 3.11.1 2022-12-06 19:05:27 +00:00
Victor Stinner 0c6b3a2d8e [3.11] Revert "[3.11] gh-98724: Fix Py_CLEAR() macro side effects (#99100)" (#99573)
Revert "gh-98724: Fix Py_CLEAR() macro side effects (#99100) (#99288)"

This reverts commit 1082890857.
2022-11-21 18:01:10 +01:00
Victor Stinner 1082890857 gh-98724: Fix Py_CLEAR() macro side effects (#99100) (#99288)
The Py_CLEAR(), Py_SETREF() and Py_XSETREF() macros now only evaluate
their argument once. If an argument has side effects, these side
effects are no longer duplicated.

Add test_py_clear() and test_py_setref() unit tests to _testcapi.

(cherry picked from commit c03e05c2e7)
2022-11-09 16:29:23 +01:00
Pablo Galindo Salgado b3cafb60af [3.11] Fix v3.11.0 release merge problems (GH-98622)
When merging the v3.11.0 tag into 3.11, some files were incorrectly updated and some others were not properly deleted.

Automerge-Triggered-By: GH:pablogsal
2022-10-24 16:30:06 -07:00