Commit graph

3877 commits

Author SHA1 Message Date
Pablo Galindo
362fc98c03 Post 3.10.16 2024-12-03 13:35:58 -05:00
Pablo Galindo
890778604a Python 3.10.16 2024-12-03 12:27:57 -05:00
Pablo Galindo
0c5fc27217 Post 3.10.15 2024-09-07 01:46:51 +01:00
Pablo Galindo
ffee63f344 Python 3.10.15 2024-09-07 01:20:06 +01:00
Łukasz Langa
83518b3511
Post 3.10.14 2024-03-20 00:40:17 +01:00
Łukasz Langa
976ea78599
Python 3.10.14 2024-03-19 22:46:16 +01:00
Sebastian Pipping
516a6d4237
[3.10] gh-115398: Expose Expat >=2.6.0 reparse deferral API (CVE-2023-52425) (GH-115623) (GH-116270)
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 https://github.com/python/cpython/pull/115138#issuecomment-1932444270 .

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-07 00:02:55 +01:00
Pablo Galindo
fc382d3dd0 Post 3.10.13 2023-08-24 14:21:57 +01:00
Pablo Galindo
49965601d6 Python 3.10.13 2023-08-24 13:46:25 +01:00
Pablo Galindo
a23ff66a59 Post 3.10.12 2023-06-06 23:49:22 +01:00
Pablo Galindo
b4e48a444e Python 3.10.12 2023-06-06 23:30:33 +01:00
Pablo Galindo
20f4222fe3 Post 3.10.11 2023-04-05 12:20:17 +01:00
Pablo Galindo
7d4cc5aa85 Python 3.10.11 2023-04-04 22:57:15 +01:00
Pablo Galindo
d7c60e361f Post 3.10.10 2023-02-08 09:59:32 +00:00
Pablo Galindo
aad5f6a891 Python 3.10.10 2023-02-07 12:05:45 +00:00
Pablo Galindo
3843973cfd Post 3.10.9 2022-12-06 21:18:42 +00:00
Pablo Galindo
1dd9be6584 Python 3.10.9 2022-12-06 18:31:21 +00:00
Pablo Galindo
af63fa0dcd
Post 3.10.8 2022-10-11 18:27:10 +01:00
Pablo Galindo
aaaf517424
Python 3.10.8 2022-10-11 12:21:44 +01:00
Miss Islington (bot)
437032e313
gh-96959: Update HTTP links which are redirected to HTTPS (GH-96961)
(cherry picked from commit db39050396)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-09-25 01:20:53 -07:00
Pablo Galindo
0abc6a3493
Post 3.10.7 2022-09-06 10:18:34 +01:00
Pablo Galindo
6cc6b13308
Python 3.10.7 2022-09-05 14:00:02 +01:00
Gregory P. Smith
eace09e63e
[3.10] gh-95778: Correctly pre-check for int-to-str conversion (GH-96537) (#96563)
Converting a large enough `int` to a decimal string raises `ValueError` as expected. However, the raise comes _after_ the quadratic-time base-conversion algorithm has run to completion. For effective DOS prevention, we need some kind of check before entering the quadratic-time loop. Oops! =)

The quick fix: essentially we catch _most_ values that exceed the threshold up front. Those that slip through will still be on the small side (read: sufficiently fast), and will get caught by the existing check so that the limit remains exact.

The justification for the current check. The C code check is:
```c
max_str_digits / (3 * PyLong_SHIFT) <= (size_a - 11) / 10
```

In GitHub markdown math-speak, writing $M$ for `max_str_digits`, $L$ for `PyLong_SHIFT` and $s$ for `size_a`, that check is:
$$\left\lfloor\frac{M}{3L}\right\rfloor \le \left\lfloor\frac{s - 11}{10}\right\rfloor$$

From this it follows that
$$\frac{M}{3L} < \frac{s-1}{10}$$
hence that
$$\frac{L(s-1)}{M} > \frac{10}{3} > \log_2(10).$$
So
$$2^{L(s-1)} > 10^M.$$
But our input integer $a$ satisfies $|a| \ge 2^{L(s-1)}$, so $|a|$ is larger than $10^M$. This shows that we don't accidentally capture anything _below_ the intended limit in the check.

<!-- gh-issue-number: gh-95778 -->
* Issue: gh-95778
<!-- /gh-issue-number -->

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
(cherry picked from commit b126196838)

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2022-09-04 09:54:56 -07:00
Gregory P. Smith
8f0fa4bd10
[3.10] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96501)
Integer to and from text conversions via CPython's bignum `int` type is not safe against denial of service attacks due to malicious input. Very large input strings with hundred thousands of digits can consume several CPU seconds.

This PR comes fresh from a pile of work done in our private PSRT security response team repo.

This backports https://github.com/python/cpython/pull/96499 aka 511ca94520

Signed-off-by: Christian Heimes [Red Hat] <christian@python.org>
Tons-of-polishing-up-by: Gregory P. Smith [Google] <greg@krypto.org>
Reviews via the private PSRT repo via many others (see the NEWS entry in the PR).

<!-- gh-issue-number: gh-95778 -->
* Issue: gh-95778
<!-- /gh-issue-number -->

I wrote up [a one pager for the release managers](https://docs.google.com/document/d/1KjuF_aXlzPUxTK4BMgezGJ2Pn7uevfX7g0_mvgHlL7Y/edit#).
2022-09-02 09:51:49 -07:00
Miss Islington (bot)
83bde57f6e
Fix typo in internal/pycore_atomic.h (GH-95939)
(cherry picked from commit 8281cbddc6)

Co-authored-by: fluesvamp <105884371+fluesvamp@users.noreply.github.com>
2022-08-12 21:05:37 -07:00
Pablo Galindo
ee2f45a061
Post 3.10.6 2022-08-02 11:05:09 +01:00
Pablo Galindo
9c7b4bd164
Python 3.10.6 2022-08-01 21:25:27 +01:00
Miss Islington (bot)
968b238b5e
[3.11] gh-93741: Add private C API _PyImport_GetModuleAttrString() (GH-93742) (GH-93792)
It combines PyImport_ImportModule() and PyObject_GetAttrString()
and saves 4-6 lines of code on every use.

Add also _PyImport_GetModuleAttr() which takes Python strings as arguments.
(cherry picked from commit 6fd4c8ec77)
(cherry picked from commit d42b3689f4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-16 00:19:29 -07:00
Pablo Galindo
1b7996cf73
Post 3.10.5 2022-06-06 18:13:35 +01:00
Pablo Galindo
f377153967
Python 3.10.5 2022-06-06 12:53:30 +01:00
Miss Islington (bot)
a4bea26ee4
gh-93065: Fix HAMT to iterate correctly over 7-level deep trees (GH-93066) (GH-93146)
Also while there, clarify a few things about why we reduce the hash to 32 bits.

Co-authored-by: Eli Libman <eli@hyro.ai>
Co-authored-by: Yury Selivanov <yury@edgedb.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>

(cherry picked from commit c1f5c903a7)
2022-05-24 10:52:29 +02:00
Pablo Galindo
4d37dc69bd
Post 3.10.4 2022-03-24 10:30:34 +00:00
Pablo Galindo
9d38120e33
Python 3.10.4 2022-03-23 20:12:04 +00:00
Pablo Galindo
b7c6119377
Post 3.10.3 2022-03-16 14:30:58 +00:00
Pablo Galindo
a342a49189
Python 3.10.3 2022-03-16 11:27:11 +00:00
Pablo Galindo Salgado
5b58db7529
[3.10] bpo-46521: Fix codeop to use a new partial-input mode of the parser (GH-31010). (GH-31213)
(cherry picked from commit 69e10976b2)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-02-08 12:25:15 +00:00
Pablo Galindo
d5c4ccfe0d
Post 3.10.2 2022-01-14 21:11:47 +00:00
Pablo Galindo
a58ebcc701
Python 3.10.2 2022-01-13 18:52:14 +00:00
Victor Stinner
72c260cf0c
[3.10] bpo-46006: Revert "bpo-40521: Per-interpreter interned strings (GH-20085)" (GH-30422) (GH-30425)
This reverts commit ea251806b8.

Keep "assert(interned == NULL);" in _PyUnicode_Fini(), but only for
the main interpreter.

Keep _PyUnicode_ClearInterned() changes avoiding the creation of a
temporary Python list object.

Leave the PyInterpreterState structure unchanged to keep the ABI
backward compatibility with Python 3.10.0: rename the "interned"
member to "unused_interned".

(cherry picked from commit 35d6540c90)
2022-01-06 16:12:28 +01:00
Miss Islington (bot)
438817fdd5
bpo-46042: Improve SyntaxError locations in the symbol table (GH-30059) (GH-30064)
(cherry picked from commit 59435eea08)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-12-12 01:24:12 +00:00
Pablo Galindo
bf1812ef61
Post 3.10.1 2021-12-06 18:52:20 +00:00
Pablo Galindo
2cd268a3a9
Python 3.10.1 2021-12-06 18:23:39 +00:00
Victor Stinner
ce5a6460ae
bpo-39026: Fix Python.h when building with Xcode (GH-29488) (GH-29732)
Fix Python.h to build C extensions with Xcode: remove a relative
include from Include/cpython/pystate.h.

(cherry picked from commit 4ae26b9c1d)
2021-11-25 13:35:22 +01:00
Miss Islington (bot)
cd85d91bc6
bpo-45893: Add missing extern C to initconfig.h (GH-29761)
Co-authored-by: Steve Dower <steve.dower@python.org>
(cherry picked from commit f4afc53bf6)

Co-authored-by: Christian Heimes <christian@python.org>
2021-11-24 13:57:41 -08:00
Łukasz Langa
904af3de2b
[3.10] bpo-45848: Allow the parser to get error lines from encoded files (GH-29646) (GH-29661)
(cherry picked from commit fdcc46d955)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-11-20 16:34:56 +01:00
Serhiy Storchaka
4641afef66
[3.10] bpo-45467: Fix IncrementalDecoder and StreamReader in the "raw-unicode-escape" codec (GH-28944) (GH-28952)
They support now splitting escape sequences between input chunks.

Add the third parameter "final" in codecs.raw_unicode_escape_decode().
It is True by default to match the former behavior.
(cherry picked from commit 39aa98346d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-14 21:23:39 +03:00
Miss Islington (bot)
0bff4ccbfd
[3.10] bpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape" codec (GH-28939) (GH-28943)
They support now splitting escape sequences between input chunks.

Add the third parameter "final" in codecs.unicode_escape_decode().
It is True by default to match the former behavior.
(cherry picked from commit c96d1546b1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-14 20:02:20 +03:00
Christian Clauss
f6798391b5
[3.10] Fix typos in the Include directory (GH-28745) (GH-28789)
(cherry picked from commit 8e8f752217)
2021-10-07 06:00:23 -07:00
Pablo Galindo
1e328afb04
Post 3.10.0 2021-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DrS6u5u6o/bGqBdvyT+0TX3sx33+WioaOrRgH
 7g4Q4NzG+JsfZewADtQHMTpe2v7yfkw9XsK7RUogqn0SXW5csXeRQf7WOdXki9mq
 gIoILPACu4gXyUpYKHGJBbDTF8JbM0sC71bo1WkENMtmFgnGyGuooz4v01NDt+RI
 ZHGjUSLjEMf68TuYnsMzCY/DwFK+uENeISC2jXZKwCTT36TkC7TFQUs24NxDNlPn
 tBf0AqBOBpLXliZZzkHFkHXFKTA+7NDEJu0vdyBq+o+3m9lBd2SJlE+1yWUT06c4
 uirJpRNUVlD/RLAecfBLByJpqKBQA4G/q/MocD32xWqQqCkeSxf1x5gc3YPmfMMp
 jXaNEzp7yP/XVIxvsT+fA6Kpp7ySxTpNNCgrhzEH3GfC/p8g7hBuPYNEjFiYOPQQ
 WS5NbJsuAi7SdfATxcjYaVkQzsn8mJYcN1cUD1HQvCNb28jLFEzzgdIPCDLkTHKL
 35SrFiTJFYXqWZa140j9L/3YROAsUJAmP+jdzRtEYqS4BKpuc0DVWt8p1+bFERH9
 UnMzn5PReIufBi5BjAW6SMNhHYoZC0nqX90T9aQAftYyuBF3d4U=
 =T4+A
 -----END PGP SIGNATURE-----

Merge tag 'v3.10.0' into 3.10

Python 3.10.0
2021-10-04 20:12:06 +01:00