[BUG] read_exp_golomb_unsigned panics/aborts on 64 or more leading zero bits (malformed SPS)
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
Start in src/rust/lib_ccxr/src/common/bitstream.rs with read_exp_golomb_unsigned, then trace the C forwarding function in cc_bitstream.c and its use from seq_parameter_set_rbsp() in avc_functions.c. Add a unit test decoding 64 zero bits and check that malformed input returns a BitstreamError rather than panicking or terminating the process; verify the SPS path can skip the NAL.
索引モデルが issue の本文から書いたものです。
説明
Summary
BitStreamRust::read_exp_golomb_unsigned (src/rust/lib_ccxr/src/common/bitstream.rs) does not limit the number of leading zero bits, so a short malformed H.264 SPS can panic (debug builds), return a wrong value (release builds) or terminate the process.
pub fn read_exp_golomb_unsigned(&mut self) -> Result<u64, BitstreamError> {
let mut zeros = 0;
while self.read_bits(1)? == 0 && self.bits_left >= 0 {
zeros += 1;
}
let remaining_bits = self.read_bits(zeros)?;
let res = ((1u64 << zeros) - 1) + remaining_bits;
Ok(res)
}
- Exactly 64 leading zeros:
1u64 << 64overflows. Debug build:panicked at ... attempt to shift left with overflow. Release build: the shift count is masked, so the result is silently wrong (1u64 << 0). - More than 64 leading zeros:
read_bitsrejectsbnum > 64withfatal!, which exits the process.
Reachability
cc_bitstream.c forwards read_exp_golomb_unsigned() to this function, and seq_parameter_set_rbsp() in avc_functions.c calls it for seq_parameter_set_id. An SPS made of the 3-byte header followed by 8-9 zero bytes reaches it from do_NAL().
Reproduction
A lib_ccxr unit test that decodes 64 zero bits panics in a debug build. 9 zero bytes in an SPS makes the process exit through fatal!.
Expected
A BitstreamError that lets the caller skip the NAL.
Suggested fix
Return Err when zeros >= 64 (and have read_bits return Err instead of calling fatal! for bnum > 64). A related spot is slice_header(), which does 1 << log2_max_frame_num in C; H.264 only allows 4..16 there.
- 主要言語
- C
- スター
- 919
- フォーク
- 604
- 平均マージ
- 9日 5時間
- マージ済み PR(30日)
- 26
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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] DVB: map-table cases in dvbsub_parse_pixel_data_block read past the object field data対応中かも @pranayr710 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 30/100
CCExtractor/ccextractor#2482 ·
メンテナーはふだん 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対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100