upipe-ts: fix use-after-free parsing PMT CA descriptors#1172
Open
kierank wants to merge 1 commit into
Open
Conversation
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>
Contributor
Author
|
Claude verified the VLA can't get > 4096 bytes. |
Contributor
Author
|
Fixes #1171 |
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.
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.