Skip to content

fix: guard composed ref walker against odd-length mapping content (#607)#608

Open
SAY-5 wants to merge 1 commit into
pb33f:mainfrom
SAY-5:fix-composed-bundler-odd-array-panic
Open

fix: guard composed ref walker against odd-length mapping content (#607)#608
SAY-5 wants to merge 1 commit into
pb33f:mainfrom
SAY-5:fix-composed-bundler-odd-array-panic

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jul 20, 2026

Copy link
Copy Markdown

BundleBytesComposed panics with index out of range when a $ref resolves to an array with an odd number of elements (for example a root-level tags list that arrives as a mapping-tagged node during composition). walkAndRewriteRefs steps through a MappingNode's content two at a time assuming key/value pairs and reads Content[i+1], which is out of bounds when the length is odd. This adds a bounds check: if the final key has no paired value, the dangling node is walked directly instead of indexing past the end. Even-length arrays are unaffected. Repro and fix verified against the reproduction in #607, and the full bundler suite plus go test ./... pass.

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.78%. Comparing base (0837c9b) to head (e266f89).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #608   +/-   ##
=======================================
  Coverage   99.78%   99.78%           
=======================================
  Files         283      283           
  Lines       34456    34459    +3     
=======================================
+ Hits        34382    34385    +3     
  Misses         46       46           
  Partials       28       28           
Flag Coverage Δ
unittests 99.78% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant