Skip to content

[GO] Fix range check on 32-bit architectures#3428

Merged
fishy merged 1 commit into
apache:masterfrom
srebhan:fix-32bit-archs
Apr 29, 2026
Merged

[GO] Fix range check on 32-bit architectures#3428
fishy merged 1 commit into
apache:masterfrom
srebhan:fix-32bit-archs

Conversation

@srebhan
Copy link
Copy Markdown
Contributor

@srebhan srebhan commented Apr 29, 2026

PR #3381 introduced range checks for integer values, however, one of the checks fails with

# github.com/apache/thrift/lib/go/thrift
/go/pkg/mod/github.com/apache/thrift@v0.23.0/lib/go/thrift/framed_transport.go:206:12: math.MaxUint32 (untyped int constant 4294967295) overflows int

on 32-bit architectures. This is because math.MaxUint32 is of untyped int which is a signed 32-bit integer on those architectures and thus cannot hold the maximum 32-bit unsigned value.

This PR fixes the issue by comparing the values as uint64 values avoiding potential overflows.

  • Did you create an Apache Jira ticket? (Request account here, not required for trivial changes)
  • If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • Did you squash your changes to a single commit? (not required, but preferred)
  • Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
  • If your change does not involve any code, include [skip ci] anywhere in the commit message to free up build resources.

@fishy fishy merged commit d2acd3c into apache:master Apr 29, 2026
88 of 89 checks passed
hc-github-team-secure-vault-core added a commit to hashicorp/vault that referenced this pull request May 7, 2026
…#14581) (#14628)

* go: resolve GHSA-wf45-q9ch-q8gh by upgrading github.com/apache/thrift

`github.com/apache/thrift` is required for the snowflake plugin. I've
updated that upstream[0] so this change is only necessary to get past
the scanner until a new version of the snowflake plugin is released and
we've updated our pin.

Using v0.23.0 was actually not possible since there's an overflow on 32 bit
architectures. Instead, we use the first commit since the release that fixes
that issue.[1]

[0]:hashicorp/vault-plugin-database-snowflake#181
[1]:apache/thrift#3428

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
hc-github-team-secure-vault-core added a commit to hashicorp/vault that referenced this pull request May 7, 2026
…#14581) (#14631) (#14647)

* go: resolve GHSA-wf45-q9ch-q8gh by upgrading github.com/apache/thrift

`github.com/apache/thrift` is required for the snowflake plugin. I've
updated that upstream[0] so this change is only necessary to get past
the scanner until a new version of the snowflake plugin is released and
we've updated our pin.

Using v0.23.0 was actually not possible since there's an overflow on 32 bit
architectures. Instead, we use the first commit since the release that fixes
that issue.[1]

[0]:hashicorp/vault-plugin-database-snowflake#181
[1]:apache/thrift#3428

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
@macabu
Copy link
Copy Markdown

macabu commented May 8, 2026

Hi, would it be possible to tag a new release with this fix? We're unable to upgrade since we need to support 32-bit architectures

@fishy
Copy link
Copy Markdown
Member

fishy commented May 10, 2026

Hi, would it be possible to tag a new release with this fix? We're unable to upgrade since we need to support 32-bit architectures

You can use go get github.com/apache/thrift@d2acd3c to get this fixed version.

@macabu
Copy link
Copy Markdown

macabu commented May 11, 2026

Thank you, we will do that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

golang patches related to go language

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants