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

Added a check for 64 bit time_t overflow #2836

Closed
wants to merge 1 commit into from

Conversation

kext
Copy link
Contributor

@kext kext commented Jun 16, 2015

This should check for overflow on platforms where time_t is 64 bit.

/* Check for overflow of 64 bit time_t */
(sizeof(time_t) == 8 && (sec > (double)INT64_MAX || (double)INT64_MIN > sec)) ||
/* Check for wrapping of tm->sec */
((sec > 0 && tm->sec < 0) || (sec < 0 && (double)tm->sec > sec))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure, but this line might be a no-op, because signed overflow is undefined behavior.

@matz matz closed this in 6a796cb Jun 17, 2015
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

Successfully merging this pull request may close these issues.

None yet

1 participant