Skip to content

cbor BUGFIX stale input log location on load failure - #2596

Merged
michalvasko merged 1 commit into
CESNET:develfrom
affan-arch:cbor-ctx-log-location
Oct 23, 2026
Merged

michalvasko merged 1 commit into
CESNET:develfrom
affan-arch:cbor-ctx-log-location

Conversation

@affan-arch

Copy link
Copy Markdown

lycbor_ctx_new() frees the context with a bare free() when cbor_load() fails, so ly_log_location_revert() never runs and the ly_in that lyd_parse_data_mem_len() frees next stays on the log location stack, which means any malformed CBOR input (a lone 0xa1 is enough) leaves the next logged error in that thread reading ->line from freed memory (ASan: heap-use-after-free in ly_vlog_build_path_line()); releasing it through lycbor_ctx_free() like lyjson_ctx_new()/lyxml_ctx_new() do fixes it, and test_invalid_input covers it.

lycbor_ctx_new() freed the context directly when cbor_load() failed,
skipping ly_log_location_revert(), so the freed ly_in stayed on the log
location stack and the next logged error read its line.
@michalvasko
michalvasko changed the base branch from master to devel October 23, 2026 06:40
@michalvasko

michalvasko commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

No problem, thanks. But changed the target branch, we never accept PRs into master.

@michalvasko
michalvasko merged commit 9ddf2d7 into CESNET:devel Oct 23, 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