Skip to content

Don't preallocate based on bsatn length prefix#5343

Open
joshua-spacetime wants to merge 1 commit into
masterfrom
joshua/fix/sats-proptest-oom
Open

Don't preallocate based on bsatn length prefix#5343
joshua-spacetime wants to merge 1 commit into
masterfrom
joshua/fix/sats-proptest-oom

Conversation

@joshua-spacetime

@joshua-spacetime joshua-spacetime commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Description of Changes

Fixes an OOM kill in the proptest bsatn_invalid_wont_decode.

bsatn_invalid_wont_decode generates arbitrary invalid bytes, proves validation fails, then still calls full AlgebraicValue::decode. For generated array-like types, decode reads a u32 length prefix, and the generic array visitor then reserves that capacity. But because they're random bytes, this could cause a huge initial allocation which could OOM kill the test process.

Now the visitor reserves a smaller initial capacity instead of assuming the binary input data is well formed.

API and ABI breaking changes

N/A

Expected complexity level and risk

1

Testing

This should fix the flaky spacetimedb-sats Test Suite failures that occasionally end in a SIGKILL.

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.

1 participant