mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-07-08 18:06:30 +00:00
Fix/cea 708 c1 bounds check (#2258)
* fix: move C0 bounds check before match, improve C1 warn message - 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 #1407 * docs: update CHANGES.TXT for #1407 fix * style: cargo fmt --------- Co-authored-by: Dhanush Varma <your@email.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
0.96.7 (unreleased)
|
0.96.7 (unreleased)
|
||||||
-------------------
|
-------------------
|
||||||
|
- Fix: Move C0 bounds check before match in CEA-708 Rust decoder to prevent process_p16 index-out-of-bounds panic on truncated ATSC1.0 TS blocks; improve C1 warn message with command code and lengths (#1407)
|
||||||
- New: Allow output \0 terminated frames via --null-terminated
|
- New: Allow output \0 terminated frames via --null-terminated
|
||||||
- New: Added ASS/SSA \pos-based positioning for CEA-608 captions when layout is simple (1–2 rows) (#1726)
|
- New: Added ASS/SSA \pos-based positioning for CEA-608 captions when layout is simple (1–2 rows) (#1726)
|
||||||
- New: Auto-extract multi-language DVB subtitles into per-language files.(#2243)
|
- New: Auto-extract multi-language DVB subtitles into per-language files.(#2243)
|
||||||
|
|||||||
@@ -77,6 +77,15 @@ impl dtvcc_service_decoder {
|
|||||||
let code = block[0];
|
let code = block[0];
|
||||||
let C0Command { command, length } = C0Command::new(code);
|
let C0Command { command, length } = C0Command::new(code);
|
||||||
debug!("C0: [{:?}] ({})", command, block.len());
|
debug!("C0: [{:?}] ({})", command, block.len());
|
||||||
|
if length as usize > block.len() {
|
||||||
|
warn!(
|
||||||
|
"dtvcc_handle_C0: command {:#04X} needs {} bytes but block only has {}; skipping",
|
||||||
|
code,
|
||||||
|
length,
|
||||||
|
block.len()
|
||||||
|
);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
match command {
|
match command {
|
||||||
// NUL command does nothing
|
// NUL command does nothing
|
||||||
C0CodeSet::NUL => {}
|
C0CodeSet::NUL => {}
|
||||||
@@ -90,14 +99,6 @@ impl dtvcc_service_decoder {
|
|||||||
C0CodeSet::P16 => self.process_p16(&block[1..]),
|
C0CodeSet::P16 => self.process_p16(&block[1..]),
|
||||||
C0CodeSet::RESERVED => {}
|
C0CodeSet::RESERVED => {}
|
||||||
}
|
}
|
||||||
if length as usize > block.len() {
|
|
||||||
warn!(
|
|
||||||
"dtvcc_handle_C0: command is {} bytes long but we only have {}",
|
|
||||||
length,
|
|
||||||
block.len()
|
|
||||||
);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
length as i32
|
length as i32
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,7 +287,13 @@ impl dtvcc_service_decoder {
|
|||||||
} = C1Command::new(code);
|
} = C1Command::new(code);
|
||||||
|
|
||||||
if length as usize > block.len() {
|
if length as usize > block.len() {
|
||||||
warn!("Warning: Not enough bytes for command.");
|
warn!(
|
||||||
|
"dtvcc_handle_C1: command {:#04X} ({}) needs {} bytes but block only has {}; skipping",
|
||||||
|
code,
|
||||||
|
name,
|
||||||
|
length,
|
||||||
|
block.len()
|
||||||
|
);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user