Skip to content

fix(read): preserve the int64 range on 32-bit systems - #228

Merged
inhere merged 1 commit into
gookit:masterfrom
Ekko82:fix/int64-width-on-32-bit
Oct 23, 2026
Merged

inhere merged 1 commit into
gookit:masterfrom
Ekko82:fix/int64-width-on-32-bit

Conversation

@Ekko82

@Ekko82 Ekko82 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Int64 passes a bit size of zero to strconv.ParseInt, which uses the native int width. On 32-bit systems, reading 2147483648 returns 2147483647 and records a range error.

Parse explicitly as 64 bits. Regression tests cover values just outside the int32 range and both int64 limits.

go test -cover ./... passes on Windows amd64 and 386. Build and formatting checks pass; existing lint findings are unchanged.

@inhere
inhere merged commit 46aa059 into gookit:master Oct 23, 2026
10 of 11 checks passed
inhere added a commit that referenced this pull request Oct 23, 2026
- Int/Uint record an error instead of silently wrapping when the int64 value is

  out of the platform int/uint range. This also fixes the two

  go/incorrect-integer-conversion alerts CodeQL reports on #228.

- the platform int/uint range is checked with the math.MaxInt/MinInt/MaxUint

  constants, so the 64-bit behavior is unchanged.

- move the 32-bit range tests into read_int_test.go, use goutil/x/assert and

  cover Int64, Duration, Int and Uint.
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.

2 participants