Modify ↓
Opened 18 years ago
Closed 18 years ago
#2255 closed defect (fixed)
No bounds checking when adding/subtracting months
| Reported by: | anonymous | Owned by: | Bhuricha Deen Sethanandha |
|---|---|---|---|
| Priority: | high | Component: | TracMetrixPlugin |
| Severity: | major | Keywords: | datetime last_day_of_month |
| Cc: | Trac Release: | 0.11 |
Description
There are several locations in web_ui.py where a month is passed into datetime as a parameter. Many instances pass in month+1 or month-1. These calls fail when month is December and January, since Dec = 12 and 12 +1 = 13 and since Jan = 1 and 1-1 = 0. datetime requires that the month be between 1 and 12. It is probably better when performing math on months to use a datetime object for the current month and then add/subtract timedelta(months=1). Then access the month attribute of the resulting datetime object. An example of the error can be found in the last_day_of_month method.
Attachments (0)
Change History (2)
comment:1 Changed 18 years ago by
| Status: | new → assigned |
|---|
comment:2 Changed 18 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Note: See
TracTickets for help on using
tickets.



Thank for your very good advice. I will take care of this right away.