Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect conversion between int types #3205

Merged
merged 4 commits into from
Oct 28, 2024

Conversation

viveksinghggits
Copy link
Contributor

@viveksinghggits viveksinghggits commented Oct 25, 2024

Change Overview

Fixes #3202

In the older version of the logic where we were reading replicas of workload in ScaleWorkload function; if val (string type) has an int value that is beyond the range of int32, even though call strconv.Atoi(val) would succeed, the next of replicas = int32(v) would result into unexpected result because the val is beyond what can be accommodated into int32 type.
This change fixes that.

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test
  • 🏗️ Build

Issues

Test Plan

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E
/kanister/pkg/function (fix-codescanning-incorrect-intconv*) » go test -check.f "ScaleWorkloadSuite"
OK: 1 passed
PASS
ok      github.com/kanisterio/kanister/pkg/function     0.894s

@mergify mergify bot merged commit 8058758 into master Oct 28, 2024
22 checks passed
@mergify mergify bot deleted the fix-codescanning-incorrect-intconv branch October 28, 2024 11:04
@@ -0,0 +1,46 @@
package function
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file needs the license header

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will make sure that I add this as part of one of the next PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix code scanning alert - Incorrect conversion between integer types
3 participants