[BUG] DVB: map-table cases in dvbsub_parse_pixel_data_block read past the object field data

Đang mở
#2,482 0 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

@pranayr710 đang làm issue này rồi.

Từ ngày 23/11/2026.

  • #2483 của @pranayr710 — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
30/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
Lĩnh vực
security

Hướng nghiên cứu

Start in dvbsub_parse_pixel_data_block() in src/lib_ccx/dvb_subtitle_decoder.c; read the location check at the top of the loop and the string helpers that stop at buf_size, since the map cases should mirror them. For cases 0x20, 0x21 and 0x22, compare buf_end - buf against the 2, 4 or 16 operand bytes needed and set parseerror and break when short. Done looks like a truncated block ending on one of those command bytes no longer reads past buf_end. Note the reporter states a patch and PR are already planned.

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

Mô tả

Summary

dvbsub_parse_pixel_data_block() in src/lib_ccx/dvb_subtitle_decoder.c loops
while (!parseerror && buf < buf_end), but three of its cases read a fixed
number of operand bytes from the stream without checking any remain. The loop
condition only guarantees one byte (the command byte) before each iteration.

Where
switch (*buf++)
{
        ...
        case 0x20:                                  // 2-bit / 4-bit map
                map2to4[0] = (*buf) >> 4;
                map2to4[1] = (*buf++) & 0xf;        // reads 2 bytes
                map2to4[2] = (*buf) >> 4;
                map2to4[3] = (*buf++) & 0xf;
                break;
        case 0x21:                                  // 2-bit / 8-bit map
                for (i = 0; i < 4; i++)
                        map2to8[i] = *buf++;        // reads 4 bytes
                break;
        case 0x22:                                  // 4-bit / 8-bit map
                for (i = 0; i < 16; i++)
                        map4to8[i] = *buf++;        // reads 16 bytes
                break;

A pixel-data sub-block whose last byte is 0x20, 0x21 or 0x22 makes the
decoder read 2, 4 or up to 16 bytes past the object's field data (buf_end is
the end of top_field_len / bottom_field_len, validated in
dvbsub_parse_object_segment).

Impact

The object's field data is a slice of the larger segment/PES buffer, so these
reads land on the adjacent bytes of that buffer rather than past the allocation
— the same reason ASan does not flag it. It is still a read past the length the
block was given, in the same class as the other bounds this function already
enforces (it checks the object location before each 0x1x pixel string, and the
string helpers stop at buf_size). The map-table cases were simply missed.

Fix

Check buf_end - buf before each of the three cases and set parseerror /
break on a short block, exactly as the location check at the top of the loop
already does.

I have a patch and will open a PR referencing this issue. Found while reading
the segment parsers after the ISDB and EPG descriptor bounds fixes.

(Analysis and patch prepared with AI assistance.)

Ngôn ngữ chính
C
Star
919
Fork
604
Merge trung bình
9 ngày 5 giờ
Pull request đã merge (30 ngày)
26

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.