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

jackson-dataformats-binary: Fix looping condition #11376

Merged
merged 2 commits into from
Dec 18, 2023

Conversation

arthurscchan
Copy link
Contributor

In Java, modulo operations are done with absolute value first, then the negative sign will be added to the modulo result if either of the left or right operands is negative. Thus if the choice is negative, the modulo result will always be negative and it automatically goes to the default branch for all the fuzzers. This makes the choice very unbalance and there are less than half chances to execute the other 18 branches. This PR fixes the bias problem by taking the absolute value of the integer choice before the modulo operation to ensure the result must be 0~18 inclusively.

Copy link

arthurscchan (verified) is either the primary contact or is in the CCs list of projects/jackson-dataformats-binary.

@arthurscchan arthurscchan marked this pull request as ready for review December 18, 2023 13:56
@AdamKorcz AdamKorcz merged commit c5acc02 into google:master Dec 18, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants