[BUG] `avc_ctx->cc_count` is `uint8_t`/`u8`, wrapping around when H.264 access units accumulate multiple SEIs beyond 255 triplets
Maintainers usually reply within 7 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
Research direction
The counter is declared as unsigned char cc_count in src/lib_ccx/avc_functions.h and updated in copy_ccdata_to_buffer in src/lib_ccx/avc_functions.c, and the Rust mirror is the u8 field in src/rust/src/avc/common_types.rs. Start by reading copy_ccdata_to_buffer to see how cc_count indexes the buffer and what the MAX_CC_COUNT and HDCC_MAX_TRIPLETS_PER_SLOT limits assume. Done means the count type can hold 310 triplets on both sides, the two definitions agree, and the buffer bounds check still holds.
Written by the indexing model from the issue text.
Description
CCExtractor version: master (post-#2359 / commit c1043ca7)
Necessary information
- Is this a regression (i.e. did it work before)? NO
- What platform did you use? All (Linux / macOS / Windows)
- What were the used arguments? Standard H.264 / MPEG-TS extraction (
ccextractor input.ts)
Summary
In commit c1043ca7 (#2359), MAX_CC_COUNT and HDCC_MAX_TRIPLETS_PER_SLOT were raised from 31 to 310 so that H.264 access units carrying multiple SEI messages can buffer all their caption triplets without discarding the frame.
However, avc_ctx->cc_count is typed as unsigned char in C (src/lib_ccx/avc_functions.h:6) and u8 in Rust (src/rust/src/avc/common_types.rs:7). Because an 8-bit unsigned integer caps out at 255, the buffer accumulator wraps around whenever an access unit carries dense or multiple SEI packets totaling between 256 and 310 triplets.
Root Cause Analysis
1. In C (src/lib_ccx/avc_functions.c:442-453):
struct avc_ctx
{
unsigned char cc_count; // <--- uint8_t: range 0..255
unsigned char *cc_data;
...
};
void copy_ccdata_to_buffer(struct avc_ctx *ctx, char *source, int new_cc_count)
{
...
memcpy(ctx->cc_data + ctx->cc_count * 3, source, new_cc_count * 3 + 1);
ctx->cc_count += new_cc_count; // <--- Wraps modulo 256 on overflow
ctx->cc_buffer_saved = CCX_FALSE;
}
- Dominant language
- C
- Stars
- 919
- Forks
- 604
- Avg merge
- 13d 12h
- Merged PRs (30d)
- 7
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CCExtractor/ccextractor
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
CCExtractor/ccextractor#2478 ·
Maintainers usually reply within 7 days
-
[BUG] encoders: WebVTT encoder generates invalid ## delimiter and malformed @import violating W3C specificationPossibly taken @yasar710 claimed this 5 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
CCExtractor/ccextractor#2465 · 2 comments ·
Maintainers usually reply within 7 days
-
[BUG] MXF: update_tid_lut() writes past tracks[32] onto nb_tracks, turning a file-supplied track id into the write offsetPossibly taken @pranayr710 claimed this 12 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
CCExtractor/ccextractor#2457 ·
Maintainers usually reply within 7 days
-
[Security] Heap buffer overflow (OOB read past GPAC sample buffer) in process_avc_sample() at mp4.c:99 when parsing a crafted MP4 filePossibly taken @yasar710 claimed this 18 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
CCExtractor/ccextractor#2449 ·
Maintainers usually reply within 7 days
-
[BUG] DVB subtitle decoder: heap-buffer-overflow write in dvbsub_parse_clut_segment via unbounded entry_idPossibly taken @Aditya-Saroha claimed this 21 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
CCExtractor/ccextractor#2440 ·
Maintainers usually reply within 7 days
All issues in CCExtractor/ccextractor
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
python-pillow/Pillow#10590 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
openwrt/packages#31407 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day