<feed xmlns='http://www.w3.org/2005/Atom'>
<title>python.git/Objects, branch 3.8</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Objects?h=3.8</id>
<link rel='self' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Objects?h=3.8'/>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/'/>
<updated>2022-10-04T18:58:10Z</updated>
<entry>
<title>[3.8] gh-95778: Mention sys.set_int_max_str_digits() in error message (GH-96874) (GH-96877) (GH-97835)</title>
<updated>2022-10-04T18:58:10Z</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2022-10-04T18:58:10Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=dca2fd28235bca84935701d468996fd1b3adbb12'/>
<id>urn:sha1:dca2fd28235bca84935701d468996fd1b3adbb12</id>
<content type='text'>
[3.9] gh-95778: Mention sys.set_int_max_str_digits() in error message (GH-96874) (GH-96877)

When ValueError is raised if an integer is larger than the limit,
mention sys.set_int_max_str_digits() in the error message.

(cherry picked from commit e841ffc915e82e5ea6e3b473205417d63494808d)

Co-authored-by: Ned Deily &lt;nad@python.org&gt;
(cherry picked from commit 41188134bd2120f0cedd681ed88743c11c7f3742)

Co-authored-by: Victor Stinner &lt;vstinner@python.org&gt;</content>
</entry>
<entry>
<title>[3.8] gh-97616: list_resize() checks for integer overflow (GH-97617) (GH-97628)</title>
<updated>2022-10-04T17:08:24Z</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2022-10-04T17:08:24Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=f9ce9d4684cc293f40171af8fde253e4762baf9d'/>
<id>urn:sha1:f9ce9d4684cc293f40171af8fde253e4762baf9d</id>
<content type='text'>
gh-97616: list_resize() checks for integer overflow (GH-97617)

Fix multiplying a list by an integer (list *= int): detect the
integer overflow when the new allocated length is close to the
maximum size.  Issue reported by Jordan Limor.

list_resize() now checks for integer overflow before multiplying the
new allocated length by the list item size (sizeof(PyObject*)).
(cherry picked from commit a5f092f3c469b674b8d9ccbd4e4377230c9ac7cf)

Co-authored-by: Victor Stinner &lt;vstinner@python.org&gt;</content>
</entry>
<entry>
<title>[3.8] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96503)</title>
<updated>2022-09-05T20:26:09Z</updated>
<author>
<name>Gregory P. Smith</name>
<email>greg@krypto.org</email>
</author>
<published>2022-09-05T20:26:09Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=b5e331fdb38684808ffc540d53e8595bdc408b89'/>
<id>urn:sha1:b5e331fdb38684808ffc540d53e8595bdc408b89</id>
<content type='text'>
* Correctly pre-check for int-to-str conversion

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) &lt;= (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} &lt; \frac{s-1}{10}$$
hence that
$$\frac{L(s-1)}{M} &gt; \frac{10}{3} &gt; \log_2(10).$$
So
$$2^{L(s-1)} &gt; 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.

&lt;!-- gh-issue-number: gh-95778 --&gt;
* Issue: gh-95778
&lt;!-- /gh-issue-number --&gt;

Co-authored-by: Gregory P. Smith [Google LLC] &lt;greg@krypto.org&gt;
Co-authored-by: Christian Heimes &lt;christian@python.org&gt;
Co-authored-by: Mark Dickinson &lt;dickinsm@gmail.com&gt;</content>
</entry>
<entry>
<title>[3.8] bpo-33930: Fix segfault with deep recursion when cleaning method objects (GH-27678) (GH-27721)</title>
<updated>2021-08-11T15:35:38Z</updated>
<author>
<name>Łukasz Langa</name>
<email>lukasz@langa.pl</email>
</author>
<published>2021-08-11T15:35:38Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=09d814b3833c2c852f4f233297b4561028782d2a'/>
<id>urn:sha1:09d814b3833c2c852f4f233297b4561028782d2a</id>
<content type='text'>
(cherry picked from commit bfc2d5a5c4550ab3a2fadeb9459b4bd948ff61a2)

Co-authored-by: Pablo Galindo Salgado &lt;Pablogsal@gmail.com&gt;</content>
</entry>
<entry>
<title>bpo-44872: use new trashcan macros in framobject.c (GH-27683) (GH-27692)</title>
<updated>2021-08-10T07:55:46Z</updated>
<author>
<name>Irit Katriel</name>
<email>1055913+iritkatriel@users.noreply.github.com</email>
</author>
<published>2021-08-10T07:55:46Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=b019ffed5debb13358a946a8e2d20594c7c181f3'/>
<id>urn:sha1:b019ffed5debb13358a946a8e2d20594c7c181f3</id>
<content type='text'>
</content>
</entry>
<entry>
<title>bpo-42800: Add audit events for f_code and tb_frame (GH-24182)</title>
<updated>2021-05-03T13:24:05Z</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2021-05-03T13:24:05Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=8ab272f0f3dd7da44f8e21d2a5a39c2ab39490d6'/>
<id>urn:sha1:8ab272f0f3dd7da44f8e21d2a5a39c2ab39490d6</id>
<content type='text'>
Accessing the following attributes will now fire PEP 578 style audit hooks as (object.__getattr__, obj, name):
* PyTracebackObject: tb_frame
* PyFrameObject: f_code
* PyGenObject: gi_code, gi_frame
* PyCoroObject: cr_code, cr_frame
* PyAsyncGenObject: ag_code, ag_frame
(cherry picked from commit bb2f3ff7a8f0c3565ccc1946dba7e09a3f7dc209)

Co-authored-by: Steve Dower &lt;steve.dower@python.org&gt;</content>
</entry>
<entry>
<title>bpo-43962: Fix _PyInterpreterState_IDIncref() (GH-25683) (GH-25686)</title>
<updated>2021-04-28T13:46:57Z</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2021-04-28T13:46:57Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=77db337f1e69213e62ba79a797540cc4ac23492e'/>
<id>urn:sha1:77db337f1e69213e62ba79a797540cc4ac23492e</id>
<content type='text'>
_PyInterpreterState_IDIncref() now calls
_PyInterpreterState_IDInitref() and always increments id_refcount.

(cherry picked from commit 32c5a174445ec93747240cd8472012276ed27acf)</content>
</entry>
<entry>
<title>bpo-42924: Fix incorrect copy in bytearray_repeat (GH-24208) (#24212)</title>
<updated>2021-04-26T19:40:38Z</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2021-04-26T19:40:38Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=e1203e8001432a08b87b54867490beb19a694069'/>
<id>urn:sha1:e1203e8001432a08b87b54867490beb19a694069</id>
<content type='text'>
Before, using the * operator to repeat a bytearray would copy data from the start of
the internal buffer (ob_bytes) and not from the start of the actual data (ob_start).
(cherry picked from commit 61d8c54f43a7871d016f98b38f86858817d927d5)

Co-authored-by: Tobias Holl &lt;TobiasHoll@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>bpo-35883: Py_DecodeLocale() escapes invalid Unicode characters (GH-24843) (GH-24906)</title>
<updated>2021-03-29T19:36:47Z</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2021-03-29T19:36:47Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=3b6e61ee0812359029cac176042d9c835c60f185'/>
<id>urn:sha1:3b6e61ee0812359029cac176042d9c835c60f185</id>
<content type='text'>
Python no longer fails at startup with a fatal error if a command
line argument contains an invalid Unicode character.

The Py_DecodeLocale() function now escapes byte sequences which would
be decoded as Unicode characters outside the [U+0000; U+10ffff]
range.

Use MAX_UNICODE constant in unicodeobject.c.
(cherry picked from commit 9976834f807ea63ca51bc4f89be457d734148682)

Co-authored-by: Victor Stinner &lt;vstinner@python.org&gt;

Co-authored-by: Victor Stinner &lt;vstinner@python.org&gt;</content>
</entry>
<entry>
<title>[3.8] bpo-40052: Fix alignment issue in PyVectorcall_Function() (GH-23999) (GH-24120)</title>
<updated>2021-01-12T14:45:05Z</updated>
<author>
<name>Petr Viktorin</name>
<email>encukou@gmail.com</email>
</author>
<published>2021-01-12T14:45:05Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=187f76def8a5bd0af7ab512575cad30cfe624b05'/>
<id>urn:sha1:187f76def8a5bd0af7ab512575cad30cfe624b05</id>
<content type='text'>
Co-Authored-By: Andreas Schneider &lt;asn@cryptomilk.org&gt;
Co-Authored-By: Antoine Pitrou &lt;antoine@python.org&gt;.
Co-authored-by: Petr Viktorin &lt;encukou@gmail.com&gt;

(cherry picked from commit 056c08211b402b4dbc1530a9de9d00ad5309909f)
https://bugs.python.org/issue40052</content>
</entry>
</feed>
