Raise flatbuffers verifier max_depth for pipeline deserialization - #9427
Open
alexreinking wants to merge 1 commit into
Open
Raise flatbuffers verifier max_depth for pipeline deserialization#9427alexreinking wants to merge 1 commit into
alexreinking wants to merge 1 commit into
Conversation
PR #9395 added flatbuffer verification before deserializing a pipeline, but used the verifier's default max_depth (64). Each Stmt/Expr node serializes as one flatbuffer table, so any pipeline with a moderately deep expression nests past that and gets rejected as "malformed" even though it's valid -- this is what broke the serialization round-trip CI bot and led to the revert in #9426. Raise max_depth to 1000 at both verification call sites instead of reverting: comfortably covers the deepest of the correctness tests that were failing (~200-400), while still bounding the deserializer's recursive descent against a corrupt or adversarial buffer. Verified a corrupted buffer is still rejected. Adds test/correctness/serialization.cpp, a regression test covering both directions: a pipeline with an expression nested past the old default round-trips cleanly, and a corrupted buffer still throws. Co-authored-by: nashit hayat <nashit@bugqore.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9427 +/- ##
==========================================
+ Coverage 70.02% 70.16% +0.14%
==========================================
Files 261 261
Lines 79393 79403 +10
Branches 19359 19361 +2
==========================================
+ Hits 55593 55713 +120
+ Misses 17915 17892 -23
+ Partials 5885 5798 -87 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
mcourteaux
approved these changes
Sep 4, 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.
Summary
#9395 added flatbuffer verification before deserializing a pipeline, but used the verifier's default
max_depthof 64. EachStmt/Exprnode serializes as one flatbuffer table, so any pipeline with a moderately deep expression nests past that and gets rejected as "malformed" even though it's valid. This is what broke the serialization round-trip CI bot (arm-64 / coverage, which only runs the roundtrip flag on push tomain, not on PRs) and led to the revert in #9426.This is a fix-forward: raise
max_depthto 1000 at both verification call sites instead of leaving verification out entirely.arm-64 / coveragejob logs:correctness_align_bounds,correctness_code_explosion,correctness_integer_powers,correctness_loop_carry,correctness_lots_of_loop_invariants,correctness_many_inlined_selects— all build a single Expr nested past depth 64 (e.g. summing 100+ loop invariants into oneAddtree).deserialize_stmt/deserialize_expr, which recurse to a depth matching the buffer's nesting.Test plan
WITH_SERIALIZATION_JIT_ROUNDTRIP_TESTING, confirmed they pass with this fixtest/correctness/serialization.cpp: round-trips a pipeline with an Expr nested past the old default depth, and confirms a corrupted buffer still throwscorrectness_streamingandcorrectness_generator_cache(the existing tests that exercise real serialize/deserialize round-trips) still passpre-commit runpasses on all changed filesCo-authored-by: nashit hayat nashit@bugqore.com
Co-authored-by: Claude Sonnet 5 noreply@anthropic.com