mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Avoid crash in parsedate_tz() on certain invalid dates -- when the
field assumed to be the time is in fact the year, the resulting list doesn't have enough items, and this isn't checked for. Return None instead.
This commit is contained in:
parent
2d3b0d725a
commit
99e1131536
1 changed files with 3 additions and 1 deletions
|
@ -800,8 +800,10 @@ def parsedate_tz(data):
|
|||
if len(tm) == 2:
|
||||
[thh, tmm] = tm
|
||||
tss = '0'
|
||||
else:
|
||||
elif len(tm) == 3:
|
||||
[thh, tmm, tss] = tm
|
||||
else:
|
||||
return None
|
||||
try:
|
||||
yy = string.atoi(yy)
|
||||
dd = string.atoi(dd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue