Repository navigation
Storage (Desktop): initialize ListenerInternal::rest_operation_ - #1990
AustinBenoit wants to merge 1 commit into
Conversation
ListenerInternal's constructor left rest_operation_ uninitialized, so destroying a storage::Listener that was never passed to an operation read an indeterminate pointer in ~ListenerInternal() and could crash. Initialize the pointer to nullptr and add a regression test that constructs the object in pre-filled storage. Fixes #1966
|
Triggered Desktop Storage integration tests on |
✅ Integration test succeeded!Requested by @AustinBenoit on commit c5d1d6f |
There was a problem hiding this comment.
Code Review
This pull request fixes a crash in the desktop storage implementation when destroying a Listener that was never associated with a storage operation. This is resolved by explicitly initializing rest_operation_ to nullptr in the ListenerInternal constructor. Additionally, a regression test has been added to verify this behavior, and the release notes have been updated. There are no review comments, and I have no feedback to provide.
Description
ListenerInternal's constructor instorage/src/desktop/listener_desktop.ccleftrest_operation_uninitialized (and the header has no default member initializer). When afirebase::storage::Listeneris destroyed without ever being attached to aRestOperation(for example, whenPutFile()fails to open the file and returns early before creating aRestOperation),~ListenerInternal()reads an indeterminate pointer and crashes.Initialize
rest_operation_tonullptrinListenerInternal::ListenerInternaland add a desktop unit test (firebase_storage_desktop_listener_test) that constructsListenerInternalin pre-filled (0xAB) storage and destroys it without attaching aRestOperation.Testing
firebase_storage_desktop_listener_test(ListenerDesktopTest.DestroyWithoutAttachedOperation) locally on Linux (clang-19) — passed../scripts/gha/check_copyright.sh -g.Type of Change
Place an
xthe applicable box: