fix: panic on float constants in overflow analyzer#1505
Merged
ccojocar merged 1 commit intosecurego:masterfrom Feb 14, 2026
Merged
fix: panic on float constants in overflow analyzer#1505ccojocar merged 1 commit intosecurego:masterfrom
ccojocar merged 1 commit intosecurego:masterfrom
Conversation
Closed
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1505 +/- ##
==========================================
- Coverage 68.49% 66.73% -1.77%
==========================================
Files 75 94 +19
Lines 4384 7301 +2917
==========================================
+ Hits 3003 4872 +1869
- Misses 1233 2197 +964
- Partials 148 232 +84 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ccojocar
approved these changes
Feb 14, 2026
flimzy
pushed a commit
to flimzy/gosec
that referenced
this pull request
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: prevent panic on float constants in conversion overflow analyzer
The issue is that gosec v2.23.0 panics with "-1 not an Int" when analyzing code with float-to-int conversions because
constant.Int64Val()panics when called on non-Int constants.Fixes #1502
Note: As part of this, we can also improve code coverage for utility, beyond the scope of this PR but we can detect upfront when any future panics happen.