<feed xmlns='http://www.w3.org/2005/Atom'>
<title>python.git/Lib/test/test_ast.py, branch 3.8</title>
<subtitle>Python interpreter</subtitle>
<id>http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Lib/test/test_ast.py?h=3.8</id>
<link rel='self' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Lib/test/test_ast.py?h=3.8'/>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/'/>
<updated>2022-09-05T20:26:09Z</updated>
<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-40726: handle uninitalized end_lineno on ast.increment_lineno (GH-21745)</title>
<updated>2020-08-05T18:37:19Z</updated>
<author>
<name>Batuhan Taskaya</name>
<email>batuhanosmantaskaya@gmail.com</email>
</author>
<published>2020-08-05T18:37:19Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=b24c9d2b0656764bef48120d9511faf833bd7ead'/>
<id>urn:sha1:b24c9d2b0656764bef48120d9511faf833bd7ead</id>
<content type='text'>
…no (GH-20312).

(cherry picked from commit 8f4380d2f5839a321475104765221a7394a9d649)

Co-authored-by: Batuhan Taskaya &lt;batuhanosmantaskaya@gmail.com&gt;

Automerge-Triggered-By: @pablogsal</content>
</entry>
<entry>
<title>bpo-40870: Invalidate usage of some constants with ast.Name (GH-20649)</title>
<updated>2020-06-06T17:04:47Z</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2020-06-06T17:04:47Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=83a9ba442662c2a030b45955f3dd24ff4b24bb61'/>
<id>urn:sha1:83a9ba442662c2a030b45955f3dd24ff4b24bb61</id>
<content type='text'>
(cherry picked from commit 68874a8502da440a1dc4746cf73262648b870aee)

Co-authored-by: Batuhan Taskaya &lt;isidentical@gmail.com&gt;</content>
</entry>
<entry>
<title>bpo-40614: Respect feature version for f-string debug expressions (GH-20196) (GH-20466)</title>
<updated>2020-06-06T10:08:48Z</updated>
<author>
<name>Shantanu</name>
<email>hauntsaninja@users.noreply.github.com</email>
</author>
<published>2020-06-06T10:08:48Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=f7ed4d4e83f5d9e85e244a1cbc460f26436ab24d'/>
<id>urn:sha1:f7ed4d4e83f5d9e85e244a1cbc460f26436ab24d</id>
<content type='text'>
Co-authored-by: Lysandros Nikolaou &lt;lisandrosnik@gmail.com&gt;
Co-authored-by: Pablo Galindo &lt;pablogsal@gmail.com&gt;
(cherry picked from commit c116c94ff119485761460f1033cdee425bed0310)</content>
</entry>
<entry>
<title>bpo-36290: Fix keytword collision handling in AST node constructors (GH-12382)</title>
<updated>2020-05-24T21:31:47Z</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2020-05-24T21:31:47Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=907ee1f14aaf587683ced44818c5a1d1cabf4174'/>
<id>urn:sha1:907ee1f14aaf587683ced44818c5a1d1cabf4174</id>
<content type='text'>
(cherry picked from commit c73914a562580ae72048876cb42ed8e76e2c83f9)

Co-authored-by: Rémi Lapeyre &lt;remi.lapeyre@lenstra.fr&gt;</content>
</entry>
<entry>
<title>bpo-40355: Improve error messages in ast.literal_eval with malformed Dict nodes (GH-19868)</title>
<updated>2020-05-05T20:00:57Z</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2020-05-05T20:00:57Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=2a3b876b0286b22a9058510d9e51dc4d60eeb89a'/>
<id>urn:sha1:2a3b876b0286b22a9058510d9e51dc4d60eeb89a</id>
<content type='text'>
Co-authored-by: Pablo Galindo &lt;Pablogsal@gmail.com&gt;
(cherry picked from commit c21c51235aa8061da6b0593d6f857f42fd92fd8b)

Co-authored-by: Curtis Bucher &lt;cpbucher5@gmail.com&gt;</content>
</entry>
<entry>
<title>bpo-39474: Fix AST pos for expressions like (a)(b), (a)[b] and (a).b. (GH-18477)</title>
<updated>2020-02-12T20:56:44Z</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2020-02-12T20:56:44Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=2076d4f97ef514bb4dc4ca768fbaa3f538ce7f1f'/>
<id>urn:sha1:2076d4f97ef514bb4dc4ca768fbaa3f538ce7f1f</id>
<content type='text'>
(cherry picked from commit 6e619c48b8e804ece9521453fc8da0640a04d5b1)

Co-authored-by: Serhiy Storchaka &lt;storchaka@gmail.com&gt;</content>
</entry>
<entry>
<title>[3.8] bpo-39579: Fix Attribute end_col_offset to point at the current node (GH-18405) (GH-18408)</title>
<updated>2020-02-08T00:21:38Z</updated>
<author>
<name>Lysandros Nikolaou</name>
<email>lisandrosnik@gmail.com</email>
</author>
<published>2020-02-08T00:21:38Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=8b9cebce09cb6919fdb97d8e608288a503681d13'/>
<id>urn:sha1:8b9cebce09cb6919fdb97d8e608288a503681d13</id>
<content type='text'>
(cherry picked from commit d2e1098641f98594702ef29049c3c4a3f394786f)





https://bugs.python.org/issue39579



Automerge-Triggered-By: @gvanrossum</content>
</entry>
<entry>
<title>[3.8] bpo-39080: Starred Expression's column offset fix when inside a CALL (GH-17645) (GH-17649)</title>
<updated>2019-12-18T01:41:58Z</updated>
<author>
<name>Pablo Galindo</name>
<email>Pablogsal@gmail.com</email>
</author>
<published>2019-12-18T01:41:58Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=b1f204471092678dd89117e608fa041a9589d14c'/>
<id>urn:sha1:b1f204471092678dd89117e608fa041a9589d14c</id>
<content type='text'>
… 
Co-Authored-By: Pablo Galindo &lt;Pablogsal@gmail.com&gt;
(cherry picked from commit 50d4f12958bf806a4e1a1021d70cfd5d448c5cba)

Co-authored-by: Lysandros Nikolaou &lt;lisandrosnik@gmail.com&gt;





https://bugs.python.org/issue39080</content>
</entry>
<entry>
<title>Fix elif start column offset when there is an else following (GH-17596) (GH-17600)</title>
<updated>2019-12-14T10:43:42Z</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2019-12-14T10:43:42Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=ce333cd7d5948b501a988bb56d6a1648e973577c'/>
<id>urn:sha1:ce333cd7d5948b501a988bb56d6a1648e973577c</id>
<content type='text'>
(cherry picked from commit 5936a4ce914d42af97b9238e5090dedc8d5b0bd2)

Co-authored-by: Lysandros Nikolaou &lt;lisandrosnik@gmail.com&gt;</content>
</entry>
</feed>
