HostDBContinuation::init memsets a polymorphic Action

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

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

@ANMOLSCRIPT がすでに取り組んでいます。

2026年12月5日 から。

評価

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

調査の方向性

src/iocore/hostdb/HostDB.cc の HostDBContinuation::init 周辺(376~382 行)と、古くなったレコードを更新する呼び出し(515~520 行)を読み、次にヘッダーで Action のメンバーを確認します。オブジェクト全体のゼロクリアを安全なリセットに置き換え、関連する HostDB テストを実行してください。デフォルトのアクション状態が保たれ、ポリモーフィックなストレージやスマートポインターのストレージが上書きされない状態になれば完了です。

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

説明

Bug Good First Issue HostDB

When HostDBContinuation::init is called without a continuation, it clears action with ink_zero(action) (HostDB.cc#L376-L382). ink_zero is a memset over the whole object (ink_memory.h#L210-L215). Action is not trivially copyable: it has a virtual cancel() and a Ptr<ProxyMutex> member. So the memset overwrites the vtable pointer and the smart pointer's storage, which is undefined behavior. Any later virtual call through action would jump through a null vtable.

This path runs whenever a stale HostDB record is served while a background refresh starts, because that refresh calls init with default options (HostDB.cc#L515-L520).

Assigning a default-constructed Action (action = Action{}), or resetting the fields individually, gives the intended result without the undefined behavior.


generated with Claude Opus 5.5 by Josiah VanderZee

主要言語
C++
スター
2k
フォーク
903
平均マージ
4日 4時間
マージ済み PR(30日)
135

環境構築

はじめの一歩

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

apache/trafficserver のほかの issue

apache/trafficserver の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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