Skip to content

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

Merged
odeke-em merged 1 commit intomasterfrom
rules-sdk-correctly-check-len-end-conversions-by-machine-architecture
Oct 13, 2022
Merged

rules/sdk: more accurately determine overflow for *int*(len(...)) by type & 32/64-bit architectures#55
odeke-em merged 1 commit intomasterfrom
rules-sdk-correctly-check-len-end-conversions-by-machine-architecture

Conversation

@odeke-em
Copy link
Contributor

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