Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[BUG] `avc_ctx->cc_count` is `uint8_t`/`u8`, wrapping around when H.264 access units accumulate multiple SEIs beyond 255 triplets

Đang mở
#2,379 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
62/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c, rust
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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;
}
Ngôn ngữ chính
C
Star
908
Fork
595
Merge trung bình
3 ngày 6 giờ
Pull request đã merge (30 ngày)
31

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của CCExtractor/ccextractor

Tất cả issue của CCExtractor/ccextractor

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.