Skip to content

check_decode: add Tree's map fields so the map-depth rows test the decoder - #54

Merged
trendvidia merged 2 commits into
mainfrom
fix/map-depth-449
Oct 31, 2026
Merged

trendvidia merged 2 commits into
mainfrom
fix/map-depth-449

Conversation

@bfrancojr

Copy link
Copy Markdown
Collaborator

Without this change, two new corpus rows fail for this port, and only because its test harness ignores the fields they use. The C++ decoders needed no fix: they already count a map's { and every PB map entry toward MaxNestingDepth, on the fast path too.

Advances trendvidia/protowire#449, with the corpus rows in protowire PR #465.

Changes

check_decode's hand-written Tree gains branches and tags. Its PB leg decodes into that struct, so it was skipping both fields as unknown. PXF needed nothing, because it compiles the corpus .proto at run time. branches holds unique_ptr<Tree>, which keeps the map's value type complete inside Tree.

Evidence

All gate runs: CPP_DIR=<this worktree> SKIP_PORTS=go,ts,java,rust,swift,dart,csharp,python bash scripts/cross_security_check.sh, from the corpus/map-depth-449 branch.

  • Before this change: exit 1, 46 pairs, with pb/deep-map-101.binpb and pb/deep-scalar-map-101.binpb as FAIL_VERDICT. All four PXF map rows passed.
  • With this change: exit 0, Ran 46 (port, corpus) pairs across 1 ports. and All ports conform. The other 7 of the 53 rows skip C++ in the manifest. Run by hand, each -100 row exits 0 and each -101 row exits 1 with nesting depth exceeds MaxNestingDepth=100.
  • To check the rows reach the decoder, I temporarily removed the map Descend()/Ascend() in DecodeMapInline (the fast path) and the map-entry check in pb.h. The gate then failed pxf/deep-nesting-maps-101.pxf, pxf/deep-nesting-scalar-map-101.pxf and pb/deep-scalar-map-101.binpb. pb/deep-map-101 still passed, because a message value is counted on its own. Both changes were reverted.
  • ctest --test-dir build --output-on-failure: 100% tests passed out of 298.

No decoder line changed, so no unit test is added. These bounds are pinned by the corpus rows, which do not run in this repo's CI.

bfrancojr and others added 2 commits October 30, 2026 18:50
The corpus's Tree gained map<string, Tree> branches and
map<string, string> tags (protowire#449). check_decode's PB leg decodes
into a hand-written struct, so it skipped both as unknown and the
pb/deep-map-101 and pb/deep-scalar-map-101 rows failed for that reason
alone. With the fields added, every row passes: the decoders already
count a map's { and every PB map entry.

The Tree map holds unique_ptr so its value type is complete at the
member's declaration, as the standard requires.

Advances trendvidia/protowire#449
@trendvidia
trendvidia merged commit 1c36716 into main Oct 31, 2026
10 checks passed
@trendvidia
trendvidia deleted the fix/map-depth-449 branch October 31, 2026 08:25
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.

2 participants