Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/lib_ccx/es_userdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,17 @@ int user_data(struct encoder_ctx *enc_ctx, struct lib_cc_decode *dec_ctx, struct
skip_bits(ustream, 5); // line_offset - unused
cc_data1 = (unsigned int)read_bits(ustream, 8);
cc_data2 = (unsigned int)read_bits(ustream, 8);
read_bits(ustream, 1); // TODO: Add syntax check */
unsigned char marker_bit = read_bits(ustream, 1);

if (ustream->bitsleft < 0)
fatal(CCX_COMMON_EXIT_BUG_BUG, "In user_data: ustream->bitsleft < 0. Cannot continue.");

if (marker_bit == 0)
{
dbg_print(CCX_DMT_VERBOSE, "user_data: SCTE-20 syntax error - marker bit is 0\n");
continue; // Skip processing this corrupted block
}

// Field_number is either
// 0 .. forbidden
// 1 .. field 1 (odd)
Expand Down
6 changes: 5 additions & 1 deletion src/rust/src/es/userdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,14 @@ pub unsafe fn user_data(
ustream.skip_bits(5)?; // line_offset - unused
let cc_data1 = ustream.read_bits(8)? as u32;
let cc_data2 = ustream.read_bits(8)? as u32;
ustream.read_bits(1)?; // TODO: Add syntax check */
let marker_bit = ustream.read_bits(1)?;
if ustream.bits_left < 0 {
fatal!(cause = ExitCause::Bug; "In user_data: ustream->bitsleft < 0. Cannot continue.");
}
if marker_bit == 0 {
debug!(msg_type = DebugMessageFlag::VERBOSE; "user_data: SCTE-20 syntax error - marker bit is 0");
continue; // Skip processing this corrupted block
}

// Field_number is either
// 0 .. forbidden
Expand Down
Loading