-
Notifications
You must be signed in to change notification settings - Fork 64
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
to_float and infinity result can crash vector #1107
Comments
dhable
added a commit
to dhable/vrl
that referenced
this issue
Nov 1, 2024
Prior to this commit, string values that would exceed the f64 bounds would return `f64::INFINITY`. This leaks a type into the VRL scripts that could cause a panic without support to check for the value. Fixes vectordotdev#1107
11 tasks
Thanks @dhable, I will take a look. Need to think a bit about the breaking behavior of this change. |
I think the proposed (breaking) change makes sense. See playground examples. We can make the check even stricter by using is_normal. |
dhable
added a commit
to dhable/vrl
that referenced
this issue
Nov 12, 2024
Prior to this commit, string values that would exceed the f64 bounds would return `f64::INFINITY`. This leaks a type into the VRL scripts that could cause a panic without support to check for the value. Fixes vectordotdev#1107
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We ran into an issue where parsing a string with
to_float
exceeds the bounds off64::MAX
, which returns a non-error infinity value.Since
err
wasnull
, it's might seem like it's safe to perform operations on this value but subtraction causes vector to panic and crash. This is becausef64::INFINITY - f64::INFINITY == f64::NAN
in rust.I can't find anything in the VRL language, besides using
to_string
to compare with "inf", that would allow me to detect this situation and avoid operations on infinite values. IMHO, I would have expected an error result instead of infinity, similar to howto_int
behaves.The text was updated successfully, but these errors were encountered: