Skip to content

Storage (Desktop): initialize ListenerInternal::rest_operation_ - #1990

Open
AustinBenoit wants to merge 1 commit into
mainfrom
fix/storage-listener-uninitialized-rest-operation
Open

AustinBenoit wants to merge 1 commit into
mainfrom
fix/storage-listener-uninitialized-rest-operation

Conversation

@AustinBenoit

Copy link
Copy Markdown
Contributor

Description

ListenerInternal's constructor in storage/src/desktop/listener_desktop.cc left rest_operation_ uninitialized (and the header has no default member initializer). When a firebase::storage::Listener is destroyed without ever being attached to a RestOperation (for example, when PutFile() fails to open the file and returns early before creating a RestOperation), ~ListenerInternal() reads an indeterminate pointer and crashes.

Initialize rest_operation_ to nullptr in ListenerInternal::ListenerInternal and add a desktop unit test (firebase_storage_desktop_listener_test) that constructs ListenerInternal in pre-filled (0xAB) storage and destroys it without attaching a RestOperation.


Testing

  • Built and ran firebase_storage_desktop_listener_test (ListenerDesktopTest.DestroyWithoutAttachedOperation) locally on Linux (clang-19) — passed.
  • Verified ./scripts/gha/check_copyright.sh -g.
  • Triggered Desktop Storage integration tests (linked in comments).

Type of Change

Place an x the applicable box:


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
@AustinBenoit

Copy link
Copy Markdown
Contributor Author

Triggered Desktop Storage integration tests on c5d1d6f7 (Ubuntu 22.04, Windows 2022, macOS 26; OpenSSL + BoringSSL): https://github.com/firebase/firebase-cpp-sdk/actions/runs/45541898809

@github-actions github-actions Bot added the tests: in-progress This PR's integration tests are in progress. label Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

✅  Integration test succeeded!

Requested by @AustinBenoit on commit c5d1d6f
Last updated: Tue Nov 24 19:56 PST 2026
View integration test log & download artifacts

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot added the tests: succeeded This PR's integration tests succeeded. label Nov 25, 2026
@firebase-workflow-trigger firebase-workflow-trigger Bot removed the tests: in-progress This PR's integration tests are in progress. label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests: succeeded This PR's integration tests succeeded.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Storage on desktop: ListenerInternal never initializes rest_operation_

1 participant