Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Don't add divergent partial paths to database#89

Merged
dcreager merged 1 commit into
mainfrom
skip-divergent-paths
May 17, 2022
Merged

Don't add divergent partial paths to database#89
dcreager merged 1 commit into
mainfrom
skip-divergent-paths

Conversation

@dcreager
Copy link
Copy Markdown
Contributor

A divergent partial path is one that starts at the root node and has an empty symbol stack precondition. That empty precondition means that it can be concatenated to any path that currently ends at the root node — including the result of that concatenation! That gives us a divergence, since we can continually prepend the path's postcondition to the current symbol stack, forever.

This patch adds a check that ensures that we never add this kind of partial path to a Database instance. (Without this check, we would end up allocating an unusably large amount of memory, since we're currently representing empty lists with a u32::max arena handle!)

A divergent partial path is one that starts at the root node and has an
empty symbol stack precondition.  That empty precondition means that it
can be concatenated to _any_ path that currently ends at the root node —
including the result of that concatenation!  That gives us a divergence,
since we can continually prepend the path's postcondition to the current
symbol stack, forever.

This patch adds a check that ensures that we never add this kind of
partial path to a `Database` instance.  (Without this check, we would
end up allocating an unusably large amount of memory, since we're
currently representing empty lists with a `u32::max` arena handle!)
@dcreager dcreager requested a review from rewinfrey May 17, 2022 19:32
Copy link
Copy Markdown

@rewinfrey rewinfrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 such a great find!

@dcreager dcreager merged commit 936a686 into main May 17, 2022
@dcreager dcreager deleted the skip-divergent-paths branch May 17, 2022 19:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants