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

binding: avoid 2038 problem on 32-bit architectures #2450

Conversation

lantw44
Copy link
Contributor

@lantw44 lantw44 commented Aug 3, 2020

Function setTimeField calls strconv.ParseInt with bit size 0 when
parsing Unix time, which means it is equivalent to specifying 32 on
32-bit architectures. This causes the function to suffer from the year
2038 problem. To fix it and keep the behavior the same on both 32-bit
and 64-bit architectures, explicitly specify bit size 64.

I am not sure if I should add a test for this pull request. It only affects 32-bit systems, but the CI only tests 64-bit systems.

Function setTimeField calls strconv.ParseInt with bit size 0 when
parsing Unix time, which means it is equivalent to specifying 32 on
32-bit architectures. This causes the function to suffer from the year
2038 problem. To fix it and keep the behavior the same on both 32-bit
and 64-bit architectures, explicitly specify bit size 64.
@codecov
Copy link

codecov bot commented Aug 3, 2020

Codecov Report

Merging #2450 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2450   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files          41       41           
  Lines        2356     2356           
=======================================
  Hits         2326     2326           
  Misses         17       17           
  Partials       13       13           
Impacted Files Coverage Δ
binding/form_mapping.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cf8b583...62af3c6. Read the comment docs.

Copy link
Member

@thinkerou thinkerou left a comment

Choose a reason for hiding this comment

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

LGTM

@thinkerou thinkerou added this to the 1.7 milestone Aug 3, 2020
@thinkerou thinkerou merged commit 30b5f7e into gin-gonic:master Aug 8, 2020
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.

None yet

2 participants