USB PD: Structured VDM Command accepts values wider than the 5-bit field
@RobertZ2011 がすでに取り組んでいます。
2026年10月27日 から。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- rust
- 領域
- embedded-iot
調査の方向性
src/vdm/structured/header.rsを読み、特に42行目付近のCommand::try_from(u8)のmatchと、149~166行目付近のsvid_specific_upper_rangeテストを確認してください。テストを実行して受け入れられる値と拒否される値を確認し、31を超える値は拒否され、16~31は引き続き受け入れられるようにしてください。対象のテストが成功すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
Command::try_from(u8) accepts every value >= 16, including 127 and 255, although the wire field is five bits wide.
What the specification requires
USB PD R3.2 V1.2 S6.4.12.2, Table 6.33 (Structured VDM Header), Command is bits 4...0:
16...31 - SVID Specific Commands
Only 16 SVID-specific command codes exist.
What the code does
src/vdm/structured/header.rs#L42:
cmd if cmd >= 16 => Ok(Self::SvidSpecific(cmd)),
Command therefore has 262 inhabitants (6 named variants plus 256 payloads) for 22 defined command codes. The real wire decoder masks to five bits, so these values cannot arrive through that path, but the public enum and its conversion accept encodings that do not exist.
Failing test
svid_specific_upper_range on branch audit. The test previously asserted that 127 and 255 are accepted:
/// USB PD R3.2 V1.2 Table 6.33 (Structured VDM Header) defines Command as a
/// 5-bit field (bits 4...0), with "16...31 - SVID Specific Commands".
///
/// 127 and 255 are not encodable in a 5-bit field and must be rejected.
#[test]
fn svid_specific_upper_range() {
for v in [16u8, 17, 31] {
assert_eq!(Command::try_from(v), Ok(Command::SvidSpecific(v)));
}
for v in [32u8, 127, 255] {
assert!(
Command::try_from(v).is_err(),
"raw={v} exceeds the 5-bit Command field (USB PD R3.2 V1.2 Table 6.33) \
and should be rejected"
);
}
}
Suggested fix
Reject values above 31. Bounding the SvidSpecific payload so it cannot hold an unencodable value is breaking but removes the possibility entirely.
- 主要言語
- Rust
- スター
- 2
- フォーク
- 8
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 9
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OpenDevicePartnership/embedded-usb-pd のほかの issue
-
bug conformance
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
USB PD: deprecated and invalid Passive Cable VDO encodings are rejected instead of normalized再び着手できるかも @RobertZ2011 が 36 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug conformance
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenDevicePartnership/embedded-usb-pd#91 · コメント 1 件 · 担当者 1 名 ·
-
USB PD: extended Alert event 5 is rejected although it is defined再び着手できるかも @RobertZ2011 が 36 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug conformance
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
OpenDevicePartnership/embedded-usb-pd#90 · コメント 1 件 · 担当者 1 名 ·
-
PD r3.2 v1.1 ->r3.2 v1.2 upgrade再び着手できるかも @RobertZ2011 が 36 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
OpenDevicePartnership/embedded-usb-pd#119 · 担当者 1 名 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
OpenDevicePartnership/embedded-usb-pd の issue をすべて見る
似ている issue
-
app bug session
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
marketing
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
macOS autosubmit enable passes unsupported --wait to launchctl bootout対応中かも @iqdoctor が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
junhoyeo/tokscale#1713 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信