[Storage] desktop ListenerInternal never initializes rest_operation_
維護者通常 3 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
在 storage/src/desktop/listener_desktop.cc 中,建構函式會初始化 listener_、bytes_transferred_ 和 total_byte_count_;issue 指出 rest_operation_ 沒有標頭檔初始化器。閱讀 ListenerInternal 的宣告和建構函式,接著檢查在建立 RestOperation 之前 PutFile 失敗時所使用 listener 的解構函式行為。完成的標準是該情況不再存取未初始化的指標。
由索引模型根據 Issue 內容生成。
描述
storage/src/desktop/listener_desktop.cc:
ListenerInternal::ListenerInternal(Listener *listener)
: listener_(listener), bytes_transferred_(-1), total_byte_count_(-1) {}
ListenerInternal::~ListenerInternal() {
MutexLock lock(mutex_);
if (rest_operation_) {
rest_operation_->cleanup().UnregisterObject(this);
rest_operation_->set_listener(nullptr);
}
}
rest_operation_ has no initializer in the header either. It only gets set in set_rest_operation(), which runs when a RestOperation is created.
So a Listener passed to a call that never creates one gets destroyed with garbage in it. PutFile() on a path that can't be opened does this. PutFileInternal completes with "Could not read file." and returns before RestCall.
class L : public firebase::storage::Listener {
void OnPaused(firebase::storage::Controller*) override {}
void OnProgress(firebase::storage::Controller*) override {}
};
auto* l = new L();
auto f = ref.PutFile("/no/such/file", l);
// wait for f, it fails with kErrorUnknown
delete l;
- Windows x64, MSVC release: access violation in the destructor
- Linux and macOS: passes, the allocation happened to be zeroed
13.12.0, and main is the same.
Fix is rest_operation_(nullptr) in the constructor.
- 主要語言
- C++
- 星號
- 326
- 分支
- 137
- 平均合併
- 3 天 8 小時
- 30 天內合併 PR
- 17
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
firebase/firebase-cpp-sdk 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 82/100
firebase/firebase-cpp-sdk#1954 ·
維護者通常 3 天內回覆
-
new type: question
難度 2/5 1-3 小時 新手友好度 85/100
firebase/firebase-cpp-sdk#1926 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
firebase/firebase-cpp-sdk#1905 · 2 則留言 ·
維護者通常 3 天內回覆
-
Windows: sign-in fails behind TLS inspection because the Schannel revocation check is strict (CRYPT_E_NO_REVOCATION_CHECK)可能已有人在做 @AustinBenoit 於 5 天前認領。 未關閉needs-triage
難度 3/5 1-2 天 新手友好度 42/100
firebase/firebase-cpp-sdk#1963 · 已指派 1 人 ·
維護者通常 3 天內回覆
-
[Database][Android] SIGSEGV in Database::DeleteInternal when embedded bridge-class init fails; FindClassInFiles passes JNI-form names to loadClass on Android可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 3/5 半天 新手友好度 55/100
firebase/firebase-cpp-sdk#1936 · 4 則留言 ·
維護者通常 3 天內回覆
查看 firebase/firebase-cpp-sdk 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 77/100
distante/esphome-components#50 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 74/100
-
feat
難度 2/5 1-3 小時 新手友好度 65/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
-
難度 1/5 1 小時以內 新手友好度 76/100
維護者通常 1 天內回覆