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

Fix GH-16834: cal_from_jd overflow on julian_day argument. #16836

Closed
wants to merge 2 commits into from

Conversation

devnexen
Copy link
Member

No description provided.

@devnexen devnexen linked an issue Nov 17, 2024 that may be closed by this pull request
@devnexen devnexen changed the title Fix GH-16384: cal_from_jd overflow on julian_day argument. Fix GH-16834: cal_from_jd overflow on julian_day argument. Nov 17, 2024
@devnexen devnexen marked this pull request as ready for review November 17, 2024 09:25
@@ -160,6 +160,10 @@ void SdnToGregorian(
/* Calculate the century (year/100). */
century = temp / DAYS_PER_400_YEARS;

if (century > ((INT_MAX / 100) - (temp / DAYS_PER_4_YEARS))) {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this check be after the reassignment of temp? temp itself can't overflow I think?

Copy link
Member Author

Choose a reason for hiding this comment

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

true I missed that line.

@devnexen devnexen closed this in 80894d8 Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Signed integer overflow in cal_from_jd
2 participants