Skip to content

upipe-ts: fix use-after-free parsing PMT CA descriptors#1172

Open
kierank wants to merge 1 commit into
Upipe:masterfrom
kierank:tsdemux
Open

upipe-ts: fix use-after-free parsing PMT CA descriptors#1172
kierank wants to merge 1 commit into
Upipe:masterfrom
kierank:tsdemux

Conversation

@kierank

@kierank kierank commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

uref_ts_flow_get_descriptor() returns a pointer directly into flow_def's udict inline buffer. The uref_ts_flow_set_capid()/set_sysid() calls (and the cat_onid/cat_esid sets inside upipe_ts_catd_parse_bissca_descs) add attributes to that same uref, which can realloc the udict buffer and invalidate the descriptor pointer. Subsequent reads through it (desc09_get_sysid, the loop advance, and the BISS-CA parse) were use-after-free, as caught by AddressSanitizer at desc09_get_sysid().

Parse a stack copy of the descriptor list instead, so the descriptor reads are independent of any reallocation of flow_def. This mirrors the existing VLA copy pattern in upipe_ts_pmtd_parse_descs(); len is bounded by the PMT program_info_length.

uref_ts_flow_get_descriptor() returns a pointer directly into flow_def's
udict inline buffer. The uref_ts_flow_set_capid()/set_sysid() calls (and
the cat_onid/cat_esid sets inside upipe_ts_catd_parse_bissca_descs) add
attributes to that same uref, which can realloc the udict buffer and
invalidate the descriptor pointer. Subsequent reads through it
(desc09_get_sysid, the loop advance, and the BISS-CA parse) were
use-after-free, as caught by AddressSanitizer at desc09_get_sysid().

Parse a stack copy of the descriptor list instead, so the descriptor
reads are independent of any reallocation of flow_def. This mirrors the
existing VLA copy pattern in upipe_ts_pmtd_parse_descs(); len is bounded
by the PMT program_info_length.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kierank

kierank commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Claude verified the VLA can't get > 4096 bytes.

@kierank

kierank commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Fixes #1171

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