codec command() silently truncates any payload longer than 255 bytes into a corrupt frame

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

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

評価

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

調査の方向性

command() がペイロード長を1バイトにキャストしている、104行目付近の crates/pod-proto/src/codec.rs を読んでください。この関数がエラーをどのように報告するか、また呼び出し元が無効なペイロードをどのように扱うかを確認し、要求された長さチェックを追加してください。ペイロードが255バイトを超える場合に拒否されるか、意図されたデバッグアサーションが発生し、有効なフレームは従来の動作を維持すれば完了です。

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

説明

bug

codec.rs command() writes the length byte as res.push(payload.len() as u8) (crates/pod-proto/src/codec.rs:104). A payload of 256+ bytes wraps mod 256, emitting a LEN that disagrees with the checksum (computed over the full payload), so the device sees a malformed/short frame. No command builds a >255B payload today (SetAlarm is the largest at 8B), and only SensorCommand::Random(Vec) is unbounded, so it is not currently triggered. But the LSP length field is inherently one byte, and the not-yet-built live MCU flash path (TODO(live-cutover)) will need to stream firmware — if it ever sends chunks through command(), oversized chunks would produce corrupt frames to an MCU mid-flash. Add a debug_assert/hard error when payload.len() > 255.


Filed from a repo-wide code audit (working tree at bcad746).

主要言語
Rust
スター
0
フォーク
0
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

GoogleBot42/podd のほかの issue

GoogleBot42/podd の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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