Skip to content

schema compile BUGFIX unique leaf in a disabled subtree - #2672

Open
lamestllama wants to merge 1 commit into
CESNET:develfrom
lamestllama:fix/unique-in-disabled-subtree
Open

lamestllama wants to merge 1 commit into
CESNET:develfrom
lamestllama:fix/unique-in-disabled-subtree

Conversation

@lamestllama

Copy link
Copy Markdown

Hi, hope this is enough of a description.

What

lys_compile_unres_check_disabled() now removes from the uniques of every list ancestor each leaf that is the disabled node or inside its subtree, and a unique left without leaves, instead of only a leaf that is itself disabled.

Why

A leaf whose ancestor below the list is disabled by if-feature is freed with that ancestor, so the list kept a pointer to freed memory, read by lysc_path() and by data validation.

Fixes #2671

Test

A list with unique "c/x" and unique "c/y k" under a disabled container c in test_node_list (test_tree_schema_compile.c) keeps one unique, k; it fails before the fix, and all of ctest passes after it.

A disabled node was removed from the uniques of its list ancestors
only when it was itself a unique leaf. When an ancestor of a unique
leaf was disabled by if-feature, the leaf was freed with it and the
list kept a pointer to it, which was then read after it was freed.
Every unique leaf in the disabled subtree is now removed, and a
unique left without leaves is removed with it.
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