Skip to content

Potential fix for code scanning alert no. 405: Incorrect conversion between integer types - #35

Merged
joel-rieke merged 6 commits into
mainfrom
security_updates_two
Jul 28, 2025
Merged

Potential fix for code scanning alert no. 405: Incorrect conversion between integer types#35
joel-rieke merged 6 commits into
mainfrom
security_updates_two

Conversation

@joel-rieke

Copy link
Copy Markdown
Collaborator

Potential fix for https://github.com/trimble-oss/go-mysql-server/security/code-scanning/405

The issue arises because float32 values are converted to int64 without verifying that the values are within the valid range for int64. To fix this:

  1. Add a bounds check for the float32 value before converting it to int64. Specifically:
    • Ensure that the value is greater than or equal to math.MinInt64 and less than or equal to math.MaxInt64. These constants define the valid range for int64.
    • An additional check should ensure that the value has no fractional component (similar to the float64 handling on lines 119–121).
  2. Modify the case float32 block in the Convert function to include these checks before performing the conversion.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

joel-rieke and others added 4 commits July 15, 2025 16:33
…etween integer types

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…etween integer types

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@joel-rieke
joel-rieke marked this pull request as ready for review July 28, 2025 16:03
@joel-rieke
joel-rieke merged commit 888eee5 into main Jul 28, 2025
9 of 12 checks passed
@joel-rieke
joel-rieke deleted the security_updates_two branch July 28, 2025 16:16
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.

1 participant