Skip to content

fix(cmd): Out of Bounds int32 Check in AWS Lambda Autoscale#238

Merged
andrew-kline merged 4 commits intomainfrom
akline/fix/integer-conversion
Sep 30, 2024
Merged

fix(cmd): Out of Bounds int32 Check in AWS Lambda Autoscale#238
andrew-kline merged 4 commits intomainfrom
akline/fix/integer-conversion

Conversation

@andrew-kline
Copy link
Contributor

Description

Motivation and Context

Solves potential overflow issue if the Kinesis downscale and upscale datapoints values are outside the upper bound for int32. This occurs in init - failure should occur pre-runtime if the env var(s) are set incorrectly.

How Has This Been Tested?

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@andrew-kline andrew-kline requested a review from a team as a code owner September 30, 2024 18:20
@jshlbrd jshlbrd self-assigned this Sep 30, 2024
}

kinesisDownscaleDatapoints = int32(dps)
if dps <= 360 && dps >= 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

The max value can be any integer, so I think borrowing this logic from your first commit may work better:

if dps <= math.MaxInt32 && dps >= 1 {

Same for the other line, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good, adjusted - i was basing off of the readme-defined maxes

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that README might have been accurate at one time, but not anymore. It could use an update.

@andrew-kline andrew-kline merged commit bcc8108 into main Sep 30, 2024
@andrew-kline andrew-kline deleted the akline/fix/integer-conversion branch September 30, 2024 21:53
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