fix(arrow): bound array recursion depth (FB-3438) - #45
Merged
Merged
Conversation
lorenzhs
marked this pull request as ready for review
August 27, 2026 12:21
tobias-fire
approved these changes
Aug 27, 2026
This reverts commit 5377470.
tobias-fire
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Firebolt validates Arrow columns before converting them into engine columns. Arrow array validation recursively walks nested child data without enforcing a nesting limit, so sufficiently deep attacker-controlled input could exhaust the native stack.
The existing JSON and Parquet guards used 1000 levels, but measurements found the shallowest stack overflow at roughly 1650 frames on a 2 MiB stack. That margin is too small for recursive walks whose frame sizes differ. We change the limit to 256 here, matching Firebolt's native type nesting limit.
Summary
Array::Validate()andArray::ValidateFull()recursion at 256 levels.256 is far beyond realistic schemas while preserving about an order of magnitude of headroom below the shallowest measured overflow.
This closes the validation-before-depth-check gap found while hardening Firebolt's Arrow consumers.
Testing
Testing is in the PackDB companion PR.