Skip to content

Guard rfl::yaml::Reader against recursive aliases and out-of-bounds literal marks - #801

Open
clockblocker wants to merge 1 commit into
munich-data-engineering:mainfrom
clockblocker:yaml-recursive-alias-guard
Open

clockblocker wants to merge 1 commit into
munich-data-engineering:mainfrom
clockblocker:yaml-recursive-alias-guard

Conversation

@clockblocker

Copy link
Copy Markdown
Contributor

Summary

Adds two safety guards in rfl::yaml::Reader:

  • Tracks active ancestor YAML nodes via a thread-local RAII guard (ActiveNodeGuard in src/rfl/yaml/Reader.cpp) across read_object and read_array so cyclic YAML aliases return an rfl::Error instead of triggering a stack overflow, while still allowing non-cyclic (DAG) alias reuse and keeping const Reader thread-safe.
  • Bounds-checks YAML::Mark::pos before indexing yaml_str_ when trimming trailing newlines on literal block scalars.

Verification

  • Built with Ninja (-O3 -Wall -Werror) and ran all YAML tests via ctest, including new regression tests in tests/yaml/test_recursive_alias.cpp.

…iteral marks

Track ancestor YAML nodes via a thread-local RAII guard (ActiveNodeGuard in
src/rfl/yaml/Reader.cpp) across read_object and read_array so cyclic YAML
aliases return an rfl::Error instead of overflowing the stack, while keeping
const Reader instances thread-safe and allowing non-cyclic (DAG) alias reuse.

Also bounds-check YAML::Mark::pos before indexing yaml_str_ when trimming
trailing newlines on literal block scalars.

This branch has not been deployed

No deployments
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