Skip to content

printer cbor BUGFIX double free when printing opaque lists - #2601

Merged
michalvasko merged 1 commit into
CESNET:develfrom
affan-arch:cbor-opaq-list-double-free
Oct 29, 2026
Merged

michalvasko merged 1 commit into
CESNET:develfrom
affan-arch:cbor-opaq-list-double-free

Conversation

@affan-arch

Copy link
Copy Markdown

cbor_print_opaq() generates the member name of an opaque list/leaf-list on the first instance and frees it twice when that instance is also the last one (ASan: double-free), while with several instances the name is already gone when the array is completed so the whole list is silently dropped from the output; any data holding an unknown list inside anydata (e.g. {"cbor-test:anydata-payload":{"foo:bar":[{"x":"y"}]}} parsed with default options) or parsed with LYD_PARSE_OPAQ triggers it when printed as CBOR, so generate the name once the array is completed like cbor_print_leaf_list() does, and test_opaque_list covers both cases.

@michalvasko
michalvasko changed the base branch from master to devel October 29, 2026 13:24

@michalvasko michalvasko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, thanks.

@michalvasko
michalvasko merged commit e2667c9 into CESNET:devel Oct 29, 2026
13 checks passed
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