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

rules/sdk: more accurately determine overflow for *int*(len(...)) by type & 32/64-bit architectures #55

Conversation

odeke-em
Copy link
Collaborator

Depending on the machine that the rule is being run on, determine if the result of an integer cast to len(value) will overflow e.g.

  • int8, uint8, int16, uint16 (len(value)) will always overflow on 32/64-bits
  • uint32(len(value)) shall overflow on 64-bit machines but not on 32-bit
  • int64(len(value)) cannot overflow on 64-bit machines nor on 32-bit
  • int(len(value)) cannot overflow on either 64-bit or 32-bit machines
  • uint(len(value)) cannot overflow on either 64-bit or 32-bit machines

Fixes #54

@odeke-em odeke-em force-pushed the rules-sdk-correctly-check-len-end-conversions-by-machine-architecture branch from 036b42b to 2d50c9c Compare October 13, 2022 22:52
…type & 32/64-bit architectures

Depending on the machine that the rule is being run on, determine if the
result of an integer cast to len(value) will overflow e.g.

* int8, uint8, int16, uint16 (len(value)) will always overflow on 32/64-bits
* uint32(len(value)) shall overflow on 64-bit machines but not on 32-bit
* int64(len(value)) cannot overflow on 64-bit machines nor on 32-bit
* int(len(value)) cannot overflow on either 64-bit or 32-bit machines
* uint(len(value)) cannot overflow on either 64-bit or 32-bit machines

Fixes #54
@odeke-em odeke-em force-pushed the rules-sdk-correctly-check-len-end-conversions-by-machine-architecture branch from 2d50c9c to 7457825 Compare October 13, 2022 22:57
@odeke-em odeke-em merged commit 7457825 into master Oct 13, 2022
@odeke-em odeke-em deleted the rules-sdk-correctly-check-len-end-conversions-by-machine-architecture branch October 13, 2022 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant