GXF: heap buffer overflow in parse_mpeg_packet() — oversized mpeg_pic_size overflows the demuxer buffer
Maintainer thường phản hồi trong vòng 1 ngày
Đá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
- 35/100
Hướng nghiên cứu
Start in src/lib_ccx/ccx_gxf.c: read parse_media() where mpeg_pic_size is decoded, then parse_mpeg_packet() where that length reaches buffered_read(). Compare it with the ancillary branch's existing packet_size guard and with alloc_demuxer_data()/BUFSIZE in ccx_demuxer.c. Done means an oversized MPEG2 packet is skipped safely and the ASan reproduction no longer reports a heap-buffer-overflow.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
parse_mpeg_packet() in src/lib_ccx/ccx_gxf.c reads mpeg_pic_size bytes from the file into the fixed-size demuxer buffer without ever checking that they fit. A GXF media packet that declares an oversized mpeg_pic_size overflows data->buffer (heap-buffer-overflow, write).
Root cause
static int parse_mpeg_packet(struct ccx_demuxer *demux, int len, struct demuxer_data *data)
{
...
result = buffered_read(demux, data->buffer + data->len, len); /* <-- */
data->len += len;
...
}
len is mpeg_pic_size, taken straight from the media packet header in parse_media():
mpeg_pic_size = buffered_get_be32(demux);
mpeg_frame_desc_flag = mpeg_pic_size >> 24;
mpeg_pic_size &= 0xFFFFFF; /* up to 16 MB, attacker controlled */
...
parse_mpeg_packet(demux, mpeg_pic_size, data);
data->buffer is a fixed malloc(BUFSIZE) (≈2 MB, alloc_demuxer_data() in ccx_demuxer.c). Nothing bounds mpeg_pic_size against it — the ancillary branch right above at least checks len < ad_track->packet_size, but the MPEG2 branch has no equivalent guard — so buffered_read writes up to ~16 MB into the 2 MB buffer.
Call path
ccx_gxf_get_more_data -> read_packet -> parse_media (TRACK_TYPE_MPEG2_525)
-> parse_mpeg_packet
AddressSanitizer output
==8==ERROR: AddressSanitizer: heap-buffer-overflow ...
#1 ... in buffered_read_opt ../src/lib_ccx/file_functions.c:376
#2 ... in buffered_read ../src/lib_ccx/file_buffer.h:72
#3 ... in parse_mpeg_packet ../src/lib_ccx/ccx_gxf.c:930
SUMMARY: AddressSanitizer: heap-buffer-overflow ... in __interceptor_read
Reproduction
A ~2 MB GXF file: a MAP packet that registers an MPEG2_525 video track (and no ancillary track), then a MEDIA packet whose mpeg_pic_size is set just over BUFSIZE with that many payload bytes following. Generator is attached to the PR.
Affected code
src/lib_ccx/ccx_gxf.c, current master (GXF demuxer is live C, not shadowed by the Rust port). Distinct from #2498 (which is the CDP cc_count read in the same file).
Fix
Skip the packet when data->len + len would exceed BUFSIZE, instead of reading it in. PR follows.
Found while auditing length handling in the GXF demuxer. Analysis and the ASan reproduction were done with AI assistance; the report and fix were reviewed by me.
- 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
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của CCExtractor/ccextractor
-
GXF: heap buffer overflow in parse_ad_cdp() — unbounded cc_count in CDP cc data sectionCó thể đã có người làm @pranayr710 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
CCExtractor/ccextractor#2498 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] + file-sequence expansion picks the digit in the extension (clip001.mp4+ only processes clip001.mp4)Có thể đã có người làm @imfarhan0105-bits đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
CCExtractor/ccextractor#2478 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] encoders: WebVTT encoder generates invalid ## delimiter and malformed @import violating W3C specificationCó thể đã có người làm @yasar710 đã nhận 7 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
CCExtractor/ccextractor#2465 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] DVB: map-table cases in dvbsub_parse_pixel_data_block read past the object field dataCó thể đã có người làm @pranayr710 đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
CCExtractor/ccextractor#2482 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] read_exp_golomb_unsigned panics/aborts on 64 or more leading zero bits (malformed SPS)Có thể đã có người làm @Souravrajvi0 đã nhận 6 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
CCExtractor/ccextractor#2470 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của CCExtractor/ccextractor
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
[TUTORIAL] Docs for Follow ModeĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area: services kind: bug preview-effort: small priority: low
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Static Analysis failureCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100