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 2010年09月17日 18:18 by bernie9998, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| segfault.py | bernie9998, 2010年09月17日 18:17 | sample code as a simple script, when executed segmentation fault occurs | ||
| segfault.py | bernie9998, 2010年09月17日 21:31 | updated demonstration script relative to current date, shows all edge cases until segmentation fault. | ||
| Messages (5) | |||
|---|---|---|---|
| msg116700 - (view) | Author: Brian Bernstein (bernie9998) | Date: 2010年09月17日 18:17 | |
When creating an int overflow via a subtraction operation with a datetime object and a timedelta object, the resulting datetime object can cause a segmentation fault when the ctime method is called. Segmentation Fault occurred on python 2.6.5 on 64 bit ubuntu lucid. Code as follows: from datetime import datetime, timedelta (datetime.now() - timedelta(734395)).ctime() |
|||
| msg116712 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2010年09月17日 19:09 | |
This does not reproduce for me on python2.6.5 gentoo linux; however, gentoo linux does have some additional post 2.6.5 patches applied. It also does not reproduce on 2.7. |
|||
| msg116723 - (view) | Author: Brian Bernstein (bernie9998) | Date: 2010年09月17日 21:31 | |
After further investigation, it appears the cause is the ability to overflow the datetime object by almost a year. I've modified the test to demonstrate this relative to the current date: from datetime import date, datetime, timedelta (datetime.now()-timedelta((date.today()-date(1,1,1)).days+364)).ctime() It seems the date can be overflowed by up to a year without throwing an Exception. The result of which is a seg fault when calling the bound ctime method. Note that anything above 364 results in OverFlowError. Below 18 still overflows, but does not seg fault, instead resulting in a weird result,e.g.: 'Tue (null) 240 17:25:37 0001' I'll update the script to demonstrate the edge cases where this occurs. |
|||
| msg116767 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年09月18日 12:11 | |
Apparently it has been fixed somewhere between 2.6.5 and 2.6.6. I get a segmentation fault in 2.6.5, but an OverflowError in all of {2.6.6, 2.7, 3.1, 3.2}.
|
|||
| msg117243 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2010年09月23日 22:31 | |
yes, this was fixed by issue7150. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:06 | admin | set | github: 54097 |
| 2010年09月23日 22:31:45 | amaury.forgeotdarc | set | status: open -> closed nosy: + amaury.forgeotdarc messages: + msg117243 superseder: datetime operations spanning MINYEAR give bad results resolution: out of date |
| 2010年09月18日 12:11:51 | pitrou | set | nosy:
+ pitrou messages: + msg116767 |
| 2010年09月17日 21:31:56 | bernie9998 | set | files:
+ segfault.py messages: + msg116723 |
| 2010年09月17日 19:32:21 | belopolsky | set | nosy:
+ mark.dickinson |
| 2010年09月17日 19:09:04 | r.david.murray | set | nosy:
+ barry, r.david.murray messages: + msg116712 |
| 2010年09月17日 19:05:19 | r.david.murray | set | nosy:
+ belopolsky |
| 2010年09月17日 18:18:00 | bernie9998 | create | |