Skip to content

Conversation

@joel-rieke
Copy link
Collaborator

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

To resolve the issue, the conversion of float64 to int64 must include an explicit check to ensure the value lies within the valid range for int64. The math package defines constants math.MaxInt64 and math.MinInt64, which can be used for this purpose. If the value is out of bounds, an appropriate error should be returned to prevent invalid conversions from propagating through the system.

Specifically:

  1. Before converting value to int64, check if it is within the range [math.MinInt64, math.MaxInt64].
  2. If value is out of bounds, return an error indicating the invalid conversion.
  3. Ensure that this fix does not disrupt the existing logic for handling fractional float64 values.

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

…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 15, 2025 18:05
@joel-rieke joel-rieke merged commit d6fd497 into main Jul 15, 2025
6 checks passed
@joel-rieke joel-rieke deleted the alert-autofix-221 branch July 15, 2025 18:10
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