-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Integer overflow with parse_rfc3339_ns #4098
Comments
Ah, seems like the max (9223372036854775807) for the I guess raising an error would be the right thing to do here, unless we'd want to replace all the calls to |
I'd propose a non-halting built-in error. It's what we do with weird inputs in other places. It'll cause the builtin to go |
Interestingly, the docs on
I'm not sure in what way they mean the result is undefined.. I guess that's what's undefined 😄 But if that's the case we might want to take even that into account. |
I agree with @srenatus here--I think that the function should generate a non-halting error in this case. That should be a relatively small change. Moving it into the plan for the next release. |
The go Time.UnixNano() function result is undefined for dates that cannot fit into an int64 when converted to Unix time in nanoseconds. Updating built-in functions to return error if date is too low/high. Fixes: open-policy-agent#4098 Signed-off-by: Johan Fylling <johan.dev@fylling.se>
#4117) * topdown: Fixing nanos int overflow issue for time.* built-in functions The go Time.UnixNano() function result is undefined for dates that cannot fit into an int64 when converted to Unix time in nanoseconds. Updating built-in functions to return error if date is too low/high. Fixes: #4098 Signed-off-by: Johan Fylling <johan.dev@fylling.se>
Short description
If you attempt to parse a date in the far future,
parse_rfc3339_ns
returns a negative number (I assume caused by integer overflow).Example:
Expected behavior
I expect it to either raise an error or return the correct number.
The text was updated successfully, but these errors were encountered: