Update FuzzingBitGen to reduce possible infinite loops.#1991
Open
copybara-service[bot] wants to merge 1 commit intomainfrom
Open
Update FuzzingBitGen to reduce possible infinite loops.#1991copybara-service[bot] wants to merge 1 commit intomainfrom
copybara-service[bot] wants to merge 1 commit intomainfrom
Conversation
7c98ddf to
1621298
Compare
c706205 to
a054677
Compare
79edb5f to
01ea91a
Compare
01ea91a to
42c5811
Compare
The old FuzzingBitGen algorithm would pull a byte from the head of the data stream to determine whether to return a min or a max, and then it would attempt to pull variate data from the tail of the stream. Once the data stream was expired it would return minimum values from the distributions, which could lead to infinite loops in rejection sampling algorithms.
The updated FuzzingBitGen now takes the following.
1. Separate control and a data streams (as absl::Span<uint8_t>).
The control stream indicates whether the distribution functions will return boundary values (min, max, mean) or a value derived from the data stream.
The data stream provides the actual byte data for generating random values.
2. A seed for an internal LCG PRNG (as uint64_t).
When the data stream is exhausted, FuzzingBitGen uses the internal LCG to generate random variates. While the old version had an internal LCG PRNG, those values were not used by the distribution functions.
The basic flow of each variate generation is:
1. Read a byte from the control stream (in fuzzing_bit_gen).
2. Depending on the byte, return a min/max/mean/variate, etc.
3. Once the data stream is expired, use an internal LCG to generate variates.
This update also calls c++ distribution functions in more cases, so that outputs are more aligned with actual distribution behavior.
Adds a test to demonstrate that std::shuffle() is properly manipulated by the fuzzing framework.
Also add additional tests to FuzzingBitGen for the distribution functions.
NOTE: This will change the variates generated by FuzzingBitGen from prior versions.
PiperOrigin-RevId: 873431571
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update FuzzingBitGen to reduce possible infinite loops.
The old FuzzingBitGen algorithm would pull a byte from the head of the data stream to determine whether to return a min or a max, and then it would attempt to pull variate data from the tail of the stream. Once the data stream was expired it would return minimum values from the distributions, which could lead to infinite loops in rejection sampling algorithms.
The updated FuzzingBitGen now takes the following.
Separate control and a data streams (as absl::Span<uint8_t>).
The control stream indicates whether the distribution functions will return boundary values (min, max, mean) or a value derived from the data stream.
The data stream provides the actual byte data for generating random values.
A seed for an internal LCG PRNG (as uint64_t).
When the data stream is exhausted, FuzzingBitGen uses the internal LCG to generate random variates. While the old version had an internal LCG PRNG, those values were not used by the distribution functions.
The basic flow of each variate generation is:
This update also calls c++ distribution functions in more cases, so that outputs are more aligned with actual distribution behavior.
Adds a test to demonstrate that std::shuffle() is properly manipulated by the fuzzing framework.
Also add additional tests to FuzzingBitGen for the distribution functions.
NOTE: This will change the variates generated by FuzzingBitGen from prior versions.