Skip to content
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

IndexError in DateTimeParser.parse #1191

Open
gabe-sherman opened this issue Oct 4, 2024 · 0 comments
Open

IndexError in DateTimeParser.parse #1191

gabe-sherman opened this issue Oct 4, 2024 · 0 comments
Labels

Comments

@gabe-sherman
Copy link

The below code triggers a list index out of range error when provided a malformed input. This occurs in parse at line 335 in arrow/parser.py.
It seems that when the fmt string is malformed this can lead to a matching error in the regex parsing later in the function.

from arrow.parser import DateTimeParser
import sys

buf = open(sys.argv[1], "rb").read().decode("utf-8")
parser = DateTimeParser()
parser.parse("foo", buf)

Version

1.3.0

POC File

https://github.com/FuturesLab/POC/blob/main/arrow-py/poc-01

How to trigger

python filename.py poc-01

Trace Report

Traceback (most recent call last):
  File "rep.py", line 6, in <module>
    parser.parse("foo", buf)
  File "anon/lib/python3.8/site-packages/arrow/parser.py", line 331, in parse
    value = match.group(token)
IndexError: no such group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant