Skip to content

[Dart] Actually use resized FlexBuffers buffer#8935

Merged
jtdavis777 merged 3 commits intogoogle:masterfrom
greenrobot-team:dart-fix-flexbuffer-resize
Mar 5, 2026
Merged

[Dart] Actually use resized FlexBuffers buffer#8935
jtdavis777 merged 3 commits intogoogle:masterfrom
greenrobot-team:dart-fix-flexbuffer-resize

Conversation

@greenrobot-team
Copy link
Contributor

Note: this is a resubmission of #8929 from a private fork to allow edits by maintainers.

When building a FlexBuffer using the Dart Builder API and adding data that exceeds the default buffer size (2048 bytes), in the _newOffset() method a larger buffer is created, but never used. This results in a RangeError.

Resolve by actually replacing the too small with the new larger buffer. Add a test that verifies this by adding multiple large strings to a vector.

This was originally reported to us by a user, so additional details can be found in objectbox/objectbox-dart#786 (note that for the reporter the data written that exceeds the buffer size is an integer and in my test a string, so the stack traces and error messages vary slightly).

When building a FlexBuffer using the Builder and adding data that exceeds the default buffer size (2048 bytes), in _newOffset() a larger buffer is created, but never used. This results in a RangeError.

Resolve by actually replacing the too small with the new larger buffer. Add a test that verifies this by adding multiple large strings to a vector.
@jtdavis777
Copy link
Collaborator

awesome, I was able to update the branch now and kicked off the pipeline. Will get this in as I can trickle things through

@jtdavis777 jtdavis777 added the ready-for-merge This PR has been approved by a maintainer and is ready for merge by a code owner label Mar 5, 2026
@jtdavis777 jtdavis777 enabled auto-merge (squash) March 5, 2026 02:11
@jtdavis777 jtdavis777 merged commit e7c6874 into google:master Mar 5, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dart ready-for-merge This PR has been approved by a maintainer and is ready for merge by a code owner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants