[BUG] DVB: map-table cases in dvbsub_parse_pixel_data_block read past the object field data
维护者通常 1 天内回复
评估
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.)
- 主要语言
- C
- 星标
- 919
- 派生
- 604
- 平均合并
- 9 天 5 小时
- 30 天内合并 PR
- 26
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CCExtractor/ccextractor 的其他 Issue
-
GXF: heap buffer overflow in parse_ad_cdp() — unbounded cc_count in CDP cc data section可能已有人在做 @pranayr710 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
CCExtractor/ccextractor#2498 ·
维护者通常 1 天内回复
-
[BUG] + file-sequence expansion picks the digit in the extension (clip001.mp4+ only processes clip001.mp4)可能已有人在做 @imfarhan0105-bits 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
CCExtractor/ccextractor#2478 · 2 条评论 ·
维护者通常 1 天内回复
-
[BUG] encoders: WebVTT encoder generates invalid ## delimiter and malformed @import violating W3C specification可能已有人在做 @yasar710 于 7 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
CCExtractor/ccextractor#2465 · 2 条评论 ·
维护者通常 1 天内回复
-
GXF: heap buffer overflow in parse_mpeg_packet() — oversized mpeg_pic_size overflows the demuxer buffer可能已有人在做 @pranayr710 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 35/100
CCExtractor/ccextractor#2500 ·
维护者通常 1 天内回复
-
[BUG] read_exp_golomb_unsigned panics/aborts on 64 or more leading zero bits (malformed SPS)可能已有人在做 @Souravrajvi0 于 6 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 76/100
CCExtractor/ccextractor#2470 · 2 条评论 ·
维护者通常 1 天内回复
查看 CCExtractor/ccextractor 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
-
难度 1/5 1 小时以内 新手友好度 92/100
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
area: services kind: bug preview-effort: small priority: low
难度 1/5 1 小时以内 新手友好度 85/100
维护者通常 1 天内回复
-
Static Analysis failure可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100