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

Add bounds checking to parsing ISO8601 timezone offset values #108672

Merged
merged 3 commits into from
May 15, 2024

Conversation

thecoop
Copy link
Member

@thecoop thecoop commented May 15, 2024

Make sure we check the bounds of values used for timezone offsets

@thecoop thecoop added >bug :Core/Infra/Core Core issues without another label labels May 15, 2024
@thecoop thecoop requested a review from a team May 15, 2024 10:43
@elasticsearchmachine elasticsearchmachine added v8.15.0 Team:Core/Infra Meta label for core/infra team labels May 15, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine
Copy link
Collaborator

Hi @thecoop, I've created a changelog YAML for you.

@thecoop
Copy link
Member Author

thecoop commented May 15, 2024

@elasticmachine update branch

Copy link
Contributor

@pgomulka pgomulka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, 1 question

@@ -70,6 +70,9 @@ public void testOutOfRange() {
assertThat(defaultParser().tryParse("2023-12-31T23:60", null), hasError(14));
assertThat(defaultParser().tryParse("2023-12-31T23:59:60", null), hasError(17));
assertThat(defaultParser().tryParse("2023-12-31T23:59:59+18:30", null), hasError(19));
assertThat(defaultParser().tryParse("2023-12-31T23:59:59+24", null), hasError(19));
assertThat(defaultParser().tryParse("2023-12-31T23:59:59+1060", null), hasError(19));
assertThat(defaultParser().tryParse("2023-12-31T23:59:59+105960", null), hasError(19));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just from the test readability point of view it, would it look better to have +10:59:60?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to vary it a bit between timezones with : and those without, thats the only reason

@thecoop thecoop merged commit ddf16db into elastic:main May 15, 2024
15 checks passed
@thecoop thecoop deleted the iso-datetime-offset-ranges branch May 15, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Core Core issues without another label Team:Core/Infra Meta label for core/infra team v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants