ccextractor icon indicating copy to clipboard operation
ccextractor copied to clipboard

[Enhance] Implement syntax check for marker bits in `es_userdata.c`

Open AhmedAlian7 opened this issue 9 months ago • 2 comments

Description

In ccextractor/src/lib_ccx/es_userdata.c at line 164, a marker bit is read during the parsing of MPEG-2 User Data or H.264 SEI captions, but its value is not currently validated.

According to standards like ATSC A/53 Part 4, these structures often contain "marker bits" or "reserved bits" that are required to be set to 1 to maintain bitstream alignment and prevent start-code emulation.

Currently, the code reads the bit but does not verify its value. If this bit is 0, it indicates either a non-compliant stream or potential corruption, which could lead to "garbage" text or synchronization issues in the output.

Proposed Solution

The implementation should capture the bit value and verify that it matches the expected value (1). If the check fails, the system should log a warning using CCExtractor's internal logging mechanism.

Implementation Plan

  • Capture the result of read_bits(ustream, 1).
  • Compare the value to the expected marker (1).
  • If the value is incorrect, trigger a dbg_print or ccx_common_logging warning with the CCX_DMT_VERBOSE flag.
  • Decide whether to continue parsing (standard behavior for robustness) or set a flag to skip the current packet if strict mode is enabled.

AhmedAlian7 avatar Feb 16 '26 11:02 AhmedAlian7

This is not an issue - let's not create one issue for each supersmall thing

cfsmp3 avatar Feb 16 '26 16:02 cfsmp3

Ok Understood, Carlos. I only created the issue to have a reference to link with the PR, but I understand the project's policy now. I'll make sure to skip the issue tracker for minor fixes like this moving forward. Thanks for the guidance! @cfsmp3

AhmedAlian7 avatar Feb 16 '26 17:02 AhmedAlian7