USB PD: Structured VDM header is parsed without checking the VDM Type bit

オープン 初心者向け
#101 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
embedded-iot

調査の方向性

src/vdm/structured/header.rs#L100-L123を読み、Raw、u32、[u8; 4]に対するHeader::try_fromの公開パース経路を調べてください。コマンドビットが1である非構造化VDMが拒否されることを示すヘッダーレベルのテストを追加し、その後、関連するテストを実行してください。bit 15がクリアされたヘッダーがパース時に拒否され、既存の構造化ヘッダーのテストが引き続き成功すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug conformance

Summary

Header::try_from never inspects bit 15, so an unstructured VDM whose low bits happen to look like a command parses successfully as a Structured VDM.

What the specification requires

USB PD R3.2 V1.2 S6.4.12.2, Table 6.33 (Structured VDM Header), bit 15:

1 = Structured VDM.

What the code does

src/vdm/structured/header.rs#L100-L123 parses Raw, u32 and [u8; 4] without testing bit 15. An unstructured VDM with low command bits equal to 1 is accepted as Discover Identity.

Suggested fix

Check bit 15 at the public parse boundary and return an error when it is clear, or document and enforce a precondition that the caller has already established the message is structured. Existing tests cover command enums only, not whole headers, so a header-level golden test should be added alongside the fix.

主要言語
Rust
スター
2
フォーク
8
平均マージ
1日 10時間
マージ済み PR(30日)
9

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenDevicePartnership/embedded-usb-pd のほかの issue

OpenDevicePartnership/embedded-usb-pd の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。