Skip to content

reject out-of-range utc offset components in TzinfoParser#1325

Open
arib06 wants to merge 1 commit into
arrow-py:masterfrom
arib06:tzinfo-offset-range
Open

reject out-of-range utc offset components in TzinfoParser#1325
arib06 wants to merge 1 commit into
arrow-py:masterfrom
arib06:tzinfo-offset-range

Conversation

@arib06

@arib06 arib06 commented Jul 14, 2026

Copy link
Copy Markdown

Pull Request Checklist

  • 🧪 Added tests for changed code.
  • 🛠️ All tests pass when run locally (run tox or make test to find out!).
  • 🧹 All linting checks pass when run locally (run tox -e lint or make lint to find out!).
  • 📚 Updated documentation for changed code.
  • ⏩ Code is up-to-date with the master branch.

Description of Changes

TzinfoParser.parse builds the offset from int(hours) * 3600 + int(minutes) * 60 without checking either field's range, so +0099 is silently accepted as +01:39 (99 minutes folded into 1h39m) while +2500/+9999 let a raw datetime ValueError escape instead of ParserError; rejecting hours > 23 or minutes > 59 in the parser keeps every valid offset working and turns the invalid ones into a normal parse error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant