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

Infinite loop if "until nil" #234

Open
ceneon opened this issue Jan 23, 2025 · 1 comment
Open

Infinite loop if "until nil" #234

ceneon opened this issue Jan 23, 2025 · 1 comment

Comments

@ceneon
Copy link

ceneon commented Jan 23, 2025

Hey,

Just wondering if it would make sense to submit a PR for this use case.

I experienced a weird app error and the app ended up calling business_days_until(x) with x being nil.

This produces an unhandled infinite loop because calling that nil generates an infinite range inside the business_time gem, and calling each ... well... crashes everything. The docker containers running the app started being restarted for a simple data error.

Line where the nil to_date parameter could be checked:

I understand that it's a fault at the app level, but I'd prefer the library rejects a nil that would never work.
Most probably other funcitions in the gem are affected by the same issue.

Happy to submit a PR, but wanted to check if it makes sense.

Thanks!

@ceneon
Copy link
Author

ceneon commented Jan 23, 2025

Well, the PR already exists since 2023 -> #222

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

No branches or pull requests

1 participant