8000 Fix incorrect index check, add test that fails pre-PR by jbrockmendel · Pull Request #420 · dateutil/dateutil · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix incorrect index check, add test that fails pre-PR #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2017

Conversation

jbrockmendel
Copy link
Contributor

In the status-quo, L824-825 checks:

                        if i < len_l and l[i] == ':':
                            res.second, res.microsecond = _parsems(l[i+1])

Avoiding an IndexError requires checking i+1 < len_l. This is easy to miss because the try/except catches IndexError. One way to trigger this is:

import dateutil.parser
dateutil.parser.IndexError = SyntaxError
dateutil.parser.parse('2017-07-17 06:21:', fuzzy=True)

@pganssle pganssle added this to the 2.7.0 milestone Jul 18, 2017
@pganssle
Copy link
Member

Ugh, this giant try/catch block really has to go.

@pganssle pganssle merged commit 7f9d40a into dateutil:master Jul 18, 2017
@jbrockmendel jbrockmendel deleted the fix_idxcheck branch July 18, 2017 03:11
@pganssle pganssle mentioned this pull request Mar 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0