This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年09月20日 19:01 by serhiy.storchaka, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| long_aslong_overflow.patch | serhiy.storchaka, 2012年09月21日 16:53 | review | ||
| long_aslong_overflow-3.3_2.patch | serhiy.storchaka, 2012年09月23日 19:15 | review | ||
| long_aslong_overflow-3.2.patch | serhiy.storchaka, 2012年10月03日 14:03 | review | ||
| long_aslong_overflow-2.7.patch | serhiy.storchaka, 2012年10月03日 14:03 | review | ||
| long_aslong_overflow_tests.patch | serhiy.storchaka, 2012年10月20日 11:29 | review | ||
| long_aslong_overflow-2.7_3.patch | serhiy.storchaka, 2013年01月09日 22:09 | review | ||
| long_aslong_overflow-3.2_3.patch | serhiy.storchaka, 2013年01月09日 22:09 | review | ||
| long_aslong_overflow-3.3_3.patch | serhiy.storchaka, 2013年01月09日 22:09 | review | ||
| long_aslong_overflow-3.4_3.patch | serhiy.storchaka, 2013年01月09日 22:09 | review | ||
| long_aslong_overflow_2-3.4.patch | serhiy.storchaka, 2013年11月29日 17:32 | Uncommitted remnants without tests | review | |
| Messages (31) | |||
|---|---|---|---|
| msg170832 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2012年09月20日 19:01 | |
There are several places where the result of PyLong_AsLong() assigned to variable of type int. It can cause unknown issues on platforms with sizeof(int) != sizeof(long). All 140 cases of PyLong_AsLong() usage should be checked. |
|||
| msg170847 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2012年09月20日 20:49 | |
Getting a C int out of a Python int is currently a bit awkward. What do you think about adding a PyLong_AsInt counterpart to PyLong_AsLong? (The alternative is to use PyLong_AsLong and repeat the same overflow detection code in many places.) |
|||
| msg170850 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2012年09月20日 21:02 | |
In the Objects subdirectory (which is all I've looked at so far), I see issues in: - fileobject.c (PyObject_AsFileDescriptor) - structseq.c (PyLong_AsLong return value used as a Py_ssize_t; probably safe, but it would be better to use PyLong_AsSsize_t). - unicodeobject.c (one place where result assigned to something of type ssize_t, one where result assigned to something of type int). |
|||
| msg170903 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2012年09月21日 16:53 | |
Here is a patch (for 3.3). I added private _PyLong_AsInt and where possible I have tried to use the appropriate function. |
|||
| msg170904 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2012年09月21日 16:59 | |
I was assigned this to itself to show that I working on the issue. Now I free up place for someone with committing privileges. |
|||
| msg171042 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2012年09月23日 14:47 | |
Looks good, in general. _PyLong_AsInt should return -1 on overflow in all cases; at the moment, it looks like it doesn't do that for values that overflow an int but not a long. |
|||
| msg171046 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2012年09月23日 15:38 | |
I added some comments on Rietveld. Apart from the bug in _PyLong_AsInt mentioned above, the patch mostly looks good. But there are many changes, some of which will have user-visible effects, and I think it's somewhat risky to make all these changes in bugfix releases (which now includes Python 3.3). Perhaps there could be a smaller patch aimed at the bugfix releases? Ideally, each fix there should be backed by a regression test. |
|||
| msg171078 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2012年09月23日 19:15 | |
Thank you for review and for found bugs. I again checked the patch, corrected the errors and dubious places. Also I corrected the error in Modules/grpmodule.c (in other places gid_t parsed as signed long) and the possible behaviour change in Modules/_io/_iomodule.c, reversed the changes in Modules/pyexpat.c. If some changes cause you have doubts, you can cherry-pick only the most obvious fixes. > Ideally, each fix there should be backed by a regression test. Unfortunately I have only platforms where sizeof(int) == sizeof(long) == sizeof(size_t). |
|||
| msg171886 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2012年10月03日 14:03 | |
Added patches for 2.7 and 3.2. |
|||
| msg173383 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2012年10月20日 11:28 | |
Here is a tests for most of fixed overflows. Some errors are difficult or impossible to reproduce. |
|||
| msg179492 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年01月09日 22:09 | |
Here are minimized patches. All included changes have tests (i.e. overflow bugs are observable). I drop grp module changes even with tests, because there are other issues for this (issue2005, issue4591). New tests for fcntl added (they test PyObject_AsFileDescriptor). If patches look good in general, I going first commit to 3.4, and if this will not break any buildbot, then I'll commit the rest patches. After that I'll continue with not included changes (if I can write tests for them). |
|||
| msg179991 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年01月14日 23:15 | |
New changeset 13e2e44db99d by Serhiy Storchaka in branch 'default': Issue #15989: Fix several occurrences of integer overflow http://hg.python.org/cpython/rev/13e2e44db99d |
|||
| msg180005 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年01月15日 09:10 | |
Changeset 525407d89277: Fix test_socket broken in previous commit (changeset 13e2e44db99d). |
|||
| msg180239 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年01月19日 10:46 | |
New changeset 974ace29ee2d by Serhiy Storchaka in branch '3.2': Issue #15989: Fix several occurrences of integer overflow http://hg.python.org/cpython/rev/974ace29ee2d New changeset 8f10c9eae183 by Serhiy Storchaka in branch '3.3': Issue #15989: Fix several occurrences of integer overflow http://hg.python.org/cpython/rev/8f10c9eae183 |
|||
| msg180240 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年01月19日 10:56 | |
New changeset d544873d62e9 by Serhiy Storchaka in branch '2.7': Issue #15989: Fix several occurrences of integer overflow http://hg.python.org/cpython/rev/d544873d62e9 |
|||
| msg180245 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2013年01月19日 13:02 | |
Several 2.7 buildbots are failing. > Unfortunately I have only platforms where sizeof(int) == sizeof(long) == sizeof(size_t). You can use your cpython ssh key to login to all snakebite buildbot machines. They are tagged with [SB]. http://mail.python.org/pipermail/python-dev/2012-September/121651.html |
|||
| msg180250 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年01月19日 19:10 | |
New changeset a78ebf9aed06 by Serhiy Storchaka in branch '2.7': Ensure that width and precision in string formatting test have type int, not long. http://hg.python.org/cpython/rev/a78ebf9aed06 |
|||
| msg180252 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年01月19日 19:14 | |
Thank you for point, Stefan. And thanks Trent for his project. |
|||
| msg180264 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年01月19日 21:36 | |
New changeset ee93a89b4e0f by Serhiy Storchaka in branch '2.7': Issue #15989: Fix possible integer overflow in str formatting as in unicode formatting. http://hg.python.org/cpython/rev/ee93a89b4e0f |
|||
| msg180916 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年01月29日 17:16 | |
Sqlite module part extracted to issue17073. |
|||
| msg204746 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年11月29日 17:32 | |
Here are remnants of initial patch which were not committed. There are no tests. |
|||
| msg229621 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2014年10月18日 00:12 | |
Are the fixes in the final patch waiting for someone to write tests, or is the intent to commit them without tests after a final review because tests are too difficult to write? |
|||
| msg229696 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2014年10月19日 20:49 | |
It would be good to write tests, but for some tests it is difficult (if possible). At least I did not see ways how to do this. |
|||
| msg247373 - (view) | Author: Robert Collins (rbcollins) * (Python committer) | Date: 2015年07月25日 19:03 | |
@serhiy - I'm a little confused about the state of this patch. It seems like you need more review? |
|||
| msg247374 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2015年07月25日 19:05 | |
Yes, it would be good if other's pair of eyes will look on the patch. |
|||
| msg248339 - (view) | Author: Robert Collins (rbcollins) * (Python committer) | Date: 2015年08月09日 21:49 | |
It looks fine to me, for whatever thats worth. I think you should commit it. |
|||
| msg250002 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2015年09月06日 18:26 | |
New changeset d51a82f68a70 by Serhiy Storchaka in branch 'default': Issue #15989: Fixed some scarcely probable integer overflows. https://hg.python.org/cpython/rev/d51a82f68a70 |
|||
| msg250003 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2015年09月06日 18:28 | |
One of changes to Modules/_io/_iomodule.c is no longer actual since issue21679. Change to Modules/selectmodule.c is no longer actual since issue23485 (f54bc2c52dfd). The rest changes were committed to 3.6 only. |
|||
| msg250009 - (view) | Author: Eric V. Smith (eric.smith) * (Python committer) | Date: 2015年09月06日 19:02 | |
Isn't Python-ast.c a generated file? |
|||
| msg250017 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2015年09月06日 20:29 | |
New changeset e53df7955192 by Serhiy Storchaka in branch 'default': Make asdl_c.py to generate Python-ast.c changed in issue #15989. https://hg.python.org/cpython/rev/e53df7955192 |
|||
| msg250018 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2015年09月06日 20:31 | |
> Isn't Python-ast.c a generated file? Good catch Eric. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:36 | admin | set | github: 60193 |
| 2015年09月06日 20:31:06 | serhiy.storchaka | set | messages: + msg250018 |
| 2015年09月06日 20:29:50 | python-dev | set | messages: + msg250017 |
| 2015年09月06日 19:02:13 | eric.smith | set | nosy:
+ eric.smith messages: + msg250009 |
| 2015年09月06日 18:28:50 | serhiy.storchaka | set | status: open -> closed resolution: fixed messages: + msg250003 stage: commit review -> resolved |
| 2015年09月06日 18:26:24 | python-dev | set | messages: + msg250002 |
| 2015年08月09日 21:49:03 | rbcollins | set | messages: + msg248339 |
| 2015年07月25日 19:05:30 | serhiy.storchaka | set | messages: + msg247374 |
| 2015年07月25日 19:03:15 | rbcollins | set | nosy:
+ rbcollins messages: + msg247373 |
| 2014年10月20日 14:39:16 | Arfrever | set | nosy:
+ Arfrever |
| 2014年10月19日 20:49:53 | serhiy.storchaka | set | messages:
+ msg229696 versions: + Python 3.5, - Python 3.3 |
| 2014年10月18日 00:12:59 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg229621 |
| 2014年05月22日 22:01:31 | skrah | set | nosy:
- skrah |
| 2013年11月29日 17:33:05 | serhiy.storchaka | set | versions: - Python 3.2 |
| 2013年11月29日 17:32:58 | serhiy.storchaka | set | files:
+ long_aslong_overflow_2-3.4.patch nosy: + vstinner messages: + msg204746 |
| 2013年01月29日 17:16:54 | serhiy.storchaka | set | messages: + msg180916 |
| 2013年01月19日 21:36:55 | python-dev | set | messages: + msg180264 |
| 2013年01月19日 19:14:46 | serhiy.storchaka | set | messages: + msg180252 |
| 2013年01月19日 19:10:35 | python-dev | set | messages: + msg180250 |
| 2013年01月19日 13:02:20 | skrah | set | nosy:
+ skrah messages: + msg180245 |
| 2013年01月19日 10:56:49 | python-dev | set | messages: + msg180240 |
| 2013年01月19日 10:46:34 | python-dev | set | messages: + msg180239 |
| 2013年01月15日 09:10:33 | serhiy.storchaka | set | messages: + msg180005 |
| 2013年01月14日 23:17:09 | serhiy.storchaka | set | stage: patch review -> commit review |
| 2013年01月14日 23:15:51 | python-dev | set | nosy:
+ python-dev messages: + msg179991 |
| 2013年01月09日 22:09:10 | serhiy.storchaka | set | files:
+ long_aslong_overflow-2.7_3.patch, long_aslong_overflow-3.2_3.patch, long_aslong_overflow-3.3_3.patch, long_aslong_overflow-3.4_3.patch messages: + msg179492 |
| 2012年12月29日 22:07:20 | serhiy.storchaka | set | assignee: serhiy.storchaka |
| 2012年12月20日 13:01:52 | serhiy.storchaka | link | issue16736 superseder |
| 2012年11月29日 14:37:00 | asvetlov | set | nosy:
+ asvetlov |
| 2012年10月24日 09:04:56 | serhiy.storchaka | set | stage: patch review |
| 2012年10月20日 11:29:26 | serhiy.storchaka | set | files: + long_aslong_overflow_tests.patch |
| 2012年10月20日 11:28:43 | serhiy.storchaka | set | messages: + msg173383 |
| 2012年10月16日 08:38:57 | serhiy.storchaka | link | issue15988 dependencies |
| 2012年10月03日 14:03:19 | serhiy.storchaka | set | files:
+ long_aslong_overflow-3.2.patch, long_aslong_overflow-2.7.patch messages: + msg171886 |
| 2012年10月03日 02:37:55 | jcea | set | nosy:
+ jcea |
| 2012年09月23日 19:15:40 | serhiy.storchaka | set | files:
+ long_aslong_overflow-3.3_2.patch messages: + msg171078 |
| 2012年09月23日 15:38:37 | mark.dickinson | set | messages:
+ msg171046 versions: + Python 3.4 |
| 2012年09月23日 14:47:05 | mark.dickinson | set | messages: + msg171042 |
| 2012年09月21日 16:59:26 | serhiy.storchaka | set | assignee: serhiy.storchaka -> (no value) messages: + msg170904 |
| 2012年09月21日 16:53:45 | serhiy.storchaka | set | files:
+ long_aslong_overflow.patch keywords: + patch messages: + msg170903 |
| 2012年09月20日 21:02:02 | mark.dickinson | set | messages: + msg170850 |
| 2012年09月20日 20:49:19 | mark.dickinson | set | nosy:
+ mark.dickinson messages: + msg170847 |
| 2012年09月20日 19:01:45 | serhiy.storchaka | create | |