Repository navigation
Guard rfl::yaml::Reader against recursive aliases and out-of-bounds literal marks - #72
Open
clockblocker wants to merge 1 commit into
Open
clockblocker wants to merge 1 commit into
clockblocker wants to merge 1 commit into
Conversation
…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 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
Split out from #42 onto
mainas an independent safety/bugfix PR:ActiveNodeGuardinsrc/rfl/yaml/Reader.cpp) acrossread_objectandread_arrayso cyclic YAML aliases return anrfl::Errorinstead of causing a stack-overflow DoS, while allowing non-cyclic (DAG) alias reuse and keepingconst Readerthread-safe.YAML::Mark::posbefore indexingyaml_str_when trimming trailing newlines on literal block scalars.Verification
-O3 -Wall -Werror) and ran all YAML tests viactest(includingtests/yaml/test_recursive_alias.cpp).