Skip to content

Fix off-by-one error in Flatbuffers domain field mutation.#2065

Merged
copybara-service[bot] merged 1 commit into
mainfrom
cl/918426209
May 26, 2026
Merged

Fix off-by-one error in Flatbuffers domain field mutation.#2065
copybara-service[bot] merged 1 commit into
mainfrom
cl/918426209

Conversation

@copybara-service

@copybara-service copybara-service Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Fix off-by-one error in Flatbuffers domain field mutation.

The random field selection in the Flatbuffers domain was using 0-based indexing with absl::Uniform, but the mutation logic was effectively 1-based. This change aligns the random selection to be 1-based by using absl::Uniform(prng, 1ul, field_count + 1) and adjusts the field iteration logic in MutateSelectedField to correctly handle the 1-based index. Also adds a check for field_count == 0 to prevent issues with absl::Uniform.

@google-cla

google-cla Bot commented May 20, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@copybara-service
copybara-service Bot force-pushed the cl/918426209 branch 3 times, most recently from 110d74f to e4cd989 Compare May 20, 2026 15:51
@copybara-service copybara-service Bot changed the title No public description Fix off-by-one error in Flatbuffers domain field mutation. May 20, 2026
The random field selection in the Flatbuffers domain was using 0-based indexing with absl::Uniform, but the mutation logic was effectively 1-based. This change aligns the random selection to be 1-based by using absl::Uniform(prng, 1ul, field_count + 1) and adjusts the field iteration logic in MutateSelectedField to correctly handle the 1-based index. Also adds a check for field_count == 0 to prevent issues with absl::Uniform.

PiperOrigin-RevId: 921308530
@copybara-service
copybara-service Bot merged commit 36a7acd into main May 26, 2026
@copybara-service
copybara-service Bot deleted the cl/918426209 branch May 26, 2026 08:40
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.

0 participants