Skip to content

No more stack overrun on pathological tree queries!#381

Merged
RossNordby merged 1 commit intomasterfrom
tree-query-heap-fallback
Aug 29, 2025
Merged

No more stack overrun on pathological tree queries!#381
RossNordby merged 1 commit intomasterfrom
tree-query-heap-fallback

Conversation

@RossNordby
Copy link
Copy Markdown
Member

@RossNordby RossNordby commented Aug 28, 2025

Historically, a few queries on Tree assumed a maximum possible depth. It was guarded by debug asserts. It was not guarded at runtime.

Simultaneously, there were pathological cases where the tree could become more like a linked list.

That's bad!

#380 and #375 fixed the so-far-observed paths to degeneracy in a tree, but having a stack overrun at runtime should not be a thing that's logically accessible!

With the unfortunate side effect of requiring BufferPools in a whole lotta places, the tree query paths will no longer explode in release mode if the tree gets really badly screwed up. Queries still default to using stack allocations, so the performance impact of this change is minimal (just a bunch of trivially predictable branches).

@RossNordby RossNordby added bug breaking-change The change contains a breaking change that may annoy everyone and require code updates! labels Aug 28, 2025
@RossNordby RossNordby merged commit 7d0b80d into master Aug 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change The change contains a breaking change that may annoy everyone and require code updates! bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant