Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Report malformed remote protocol data instead of defaulting to zero

オープン
#1,176 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
cpp

調査の方向性

Start by reading the dropped implementation in commit f7a1961 and the exception boundaries around ExecuteAdapterAndWait, NotifyStopped, HandleSpontaneousAdapterStop, WorkerThreadMain, and InvokeBackendCommand. Inspect esrevenadapter.cpp, PacketToUnorderedMap, and GdbMiAdapter::ReadMemory for the listed parsing problems. Done means malformed data is reported with its field and value, sessions tear down fully, stop-channel state is exception-safe, and unrecognized stop-reply fields are ignored.

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

説明

Follow-up to #1164 / #1166.

#1166 stops the crash by parsing remote stub data with a non-throwing helper that returns 0 on malformed input. That means a corrupt packet silently becomes a valid-looking answer — a bad thread id turns into thread 0, and we then show the user the wrong thread's registers with no indication anything is wrong. Accepted deliberately to keep the fix local during feature freeze.

The session should instead end deliberately, reporting the offending field and data. An attempt at that was dropped from #1166 (commit f7a1961); review of it showed what a real implementation needs:

  • Wider catch boundary than ExecuteAdapterAndWait. NotifyStopped runs after it returns and refreshes caches; HandleSpontaneousAdapterStop has no boundary; WorkerThreadMain runs tasks bare, so an escape is std::terminate; InvokeBackendCommand reaches monitor-command decoding directly from the API/FFI.
  • Real transport teardown. A synthetic TargetExited only updates BN-side state. The teardown lives in the adapter (m_socket->Kill(), delete m_rspConnector, InvalidateCache). Also m_adapter is never reset on any session end today, so CreateDebugAdapter reuses it.
  • RAII on the stop channel. An exception between setting and clearing m_inAdapterWait leaves a stale pending stop that swallows later adapter events.
  • Ignore unrecognized stop-reply fields. PacketToUnorderedMap parses every key:value as hex, but the spec requires unknown pairs be ignored and defines non-hex values we advertise support for (replaylog:begin, exec:<hex pathname>, fork/vfork pPID.TID). Parsing only the keys we consume is both spec-correct and smaller.

Outstanding regardless of the exception work:

  • esrevenadapter.cpp still uses raw std::stoull (:1797, :2249, :2251) and std::stoi (:2309) — the call sites #1164 describes.
  • PacketToUnorderedMap: T05thread:1:garbage; splits into three tokens and falls through to packet_map[key] = 0; values are truncated to 16 chars before validation, so trailing garbage disappears.
  • GdbMiAdapter::ReadMemory checks from_chars().ec but not full consumption, so "aZ" parses as 0x0a; odd-length replies truncate; hard errors return an all-zero buffer indistinguishable from valid memory.
主要言語
C++
スター
334
フォーク
33
平均マージ
5日 13時間
マージ済み PR(30日)
1

環境構築

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

はじめの一歩

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

Vector35/debugger のほかの issue

Vector35/debugger の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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