<feed xmlns='http://www.w3.org/2005/Atom'>
<title>python.git/Python/ast.c, 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/Python/ast.c?h=3.8</id>
<link rel='self' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Python/ast.c?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-35975: Only use cf_feature_version if PyCF_ONLY_AST in cf_flags (#21023)</title>
<updated>2020-06-28T00:35:05Z</updated>
<author>
<name>Guido van Rossum</name>
<email>guido@python.org</email>
</author>
<published>2020-06-28T00:35:05Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=e653369e76d7da6bcbcf1f09a141f47fb77df6c3'/>
<id>urn:sha1:e653369e76d7da6bcbcf1f09a141f47fb77df6c3</id>
<content type='text'>
</content>
</entry>
<entry>
<title>[3.8] bpo-41132: Use pymalloc allocator in the f-string parser (GH-21173) (GH-21184)</title>
<updated>2020-06-27T18:43:41Z</updated>
<author>
<name>Lysandros Nikolaou</name>
<email>lisandrosnik@gmail.com</email>
</author>
<published>2020-06-27T18:43:41Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=749d3bc04177ff9e2ddfd58d919b84cb4f6cf894'/>
<id>urn:sha1:749d3bc04177ff9e2ddfd58d919b84cb4f6cf894</id>
<content type='text'>
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-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>bpo-39235: Fix end location for genexp in call args (GH-17925)</title>
<updated>2020-01-09T19:39:00Z</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2020-01-09T19:39:00Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=33e033da3c1472b0aa2ae3cff06649a1ae4aa37f'/>
<id>urn:sha1:33e033da3c1472b0aa2ae3cff06649a1ae4aa37f</id>
<content type='text'>
The fix changes copy_location() to require an extra node from which to extract the end location, and fixing all 5 call sites.

https://bugs.python.org/issue39235
(cherry picked from commit a796d8ef9dd1af65f7e4d7a857b56f35b7cb6e78)

Co-authored-by: Guido van Rossum &lt;guido@python.org&gt;</content>
</entry>
<entry>
<title>bpo-39176: Improve error message for 'named assignment' (GH-17777) (GH-17778)</title>
<updated>2020-01-01T03:28:08Z</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2020-01-01T03:28:08Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=6c004955aceb8a0cd8e14afbc608ebfdf7c8aa4a'/>
<id>urn:sha1:6c004955aceb8a0cd8e14afbc608ebfdf7c8aa4a</id>
<content type='text'>
(cherry picked from commit 37143a8e3b2e9245d52f4ddebbdd1c6121c96884)

Co-authored-by: Ned Batchelder &lt;ned@nedbatchelder.com&gt;

Co-authored-by: Ned Batchelder &lt;ned@nedbatchelder.com&gt;
</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>
</feed>
