Skip to content
Myr

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

Before adoption: this commit came in with the history the project adopted, so no landing records it.

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.

authored by lantw44 · committed by GitHub · parent cf8b583 · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: thinkerou <thinkerou@gmail.com>

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:binding/form_mapping.go+1 added-1 removed
268 unmodified lines
269 }270271 switch tf := strings.ToLower(timeFormat); tf {272 case "unix", "unixnano":273 tv, err := strconv.ParseInt(val, 10, 0)273 tv, err := strconv.ParseInt(val, 10, 64)274 if err != nil {275 return err276 }277
74 unmodified lines