-
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
topdown: Fixing nanos int overflow issue for time.* built-in functions #4117
topdown: Fixing nanos int overflow issue for time.* built-in functions #4117
Conversation
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>
Adjusting min allowed time to be '1677-09-21 00:12:43.145224192'. Signed-off-by: Johan Fylling <johan.dev@fylling.se>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nitpicks inside 🙃
Making nanosecond overflow error message more concise. Updating relevant time.* built-ins to be registered with RegisterBuiltinFunc(). Signed-off-by: Johan Fylling <johan.dev@fylling.se>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Would we need a small note in the built-in docs? Just saying that it those built-ins turn into undefined if their result is outside the valid range...?
Updating docs for built-in functions. Signed-off-by: Johan Fylling <johan.dev@fylling.se>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
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