Skip to content

Conversation

@dallasmarlow
Copy link

This change addresses a reported issue where a FlatBufferBuilder could be finished with a WIPOffset created by a different builder.

Calling builder1.finish(offset_from_builder2) would compile but result in a runtime panic or data corruption, as the offset is meaningless in builder1's buffer.

The fix enforces the builder's lifetime ('fbb) on the generic type T of the WIPOffset in all finish methods (finish, finish_minimal, finish_size_prefixed, and finish_with_opts).

#8698

@google-cla
Copy link

google-cla bot commented Oct 31, 2025

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.

@github-actions github-actions bot added the rust label Oct 31, 2025
@dallasmarlow dallasmarlow force-pushed the rust-finish-lifetime-fix branch from 9f794ee to 57a9222 Compare October 31, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant