Skip to content

Avoid overflow UB in random.cpp - #7449

Merged
tlively merged 1 commit into
mainfrom
random-overflow-fix
Apr 4, 2025
Merged

Avoid overflow UB in random.cpp#7449
tlively merged 1 commit into
mainfrom
random-overflow-fix

Conversation

@tlively

@tlively tlively commented Apr 4, 2025

Copy link
Copy Markdown
Member

The random number generator adds into xorFactor in various places.
This variable was previously signed, so overflows from these adds were
UB. Make it unsigned to avoid UB.

The random number generator adds into `xorFactor` in various places.
This variable was previously signed, so overflows from these adds were
UB. Make it unsigned to avoid UB.
@tlively
tlively requested a review from kripken April 4, 2025 15:19
@tlively
tlively enabled auto-merge (squash) April 4, 2025 15:43
@tlively
tlively merged commit 62b55de into main Apr 4, 2025
@tlively
tlively deleted the random-overflow-fix branch April 4, 2025 15:58
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