Fix/cea 708 c1 bounds check#2258
Open
DhanushVarma-2 wants to merge 3 commits intoCCExtractor:masterfrom
Open
Conversation
added 3 commits
April 6, 2026 10:21
- C0 handler: bounds check was after the match, meaning process_p16(&block[1..]) could panic with an index out of bounds before the guard ran. Moved the check before the match to prevent this. - C1 handler: improved the warn message to include command code, name, and lengths for easier debugging. Fixes CCExtractor#1407
36de94e to
0ecbdd3
Compare
Collaborator
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 395f9b3...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
Congratulations: Merging this PR would fix the following tests:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
Collaborator
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 395f9b3...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
Congratulations: Merging this PR would fix the following tests:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
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.
Addresses the index-out-of-bounds panic in the CEA-708 Rust decoder on ATSC1.0 TS files (originally reported in #1407).
Root cause:
In handle_C0, the bounds check (if length as usize > block.len()) was placed after the match block. This meant C0CodeSet::P16 => self.process_p16(&block[1..]) could be called on a block with only 1 byte, causing an index-out-of-bounds panic before the guard ever ran.
Changes:
handle_C0: moved the bounds check to before the match block, with an improved warn message that includes the command code, expected length, and actual block length.
handle_C1: improved the existing warn message to include command code, name, expected length, and actual block length for easier debugging.
Testing:
cargo build passes cleanly.
The original panic scenario (truncated ATSC1.0 TS block reaching process_p16) is now safely caught and logged before any slice indexing occurs.