Skip to content

Fix Storage usage of invalid pointers. #1574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions release_build_files/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,12 @@ workflow use only during the development of your app, not for publicly shipping
code.

## Release Notes
### Upcoming Release
- Changes
- Storage (iOS): Fix invalid pointer in `StorageReference::GetFile()` when
running in a secondary thread
([#1570](https://github.com/firebase/firebase-cpp-sdk/issues/1570)).

### 11.10.0
- Changes
- General (Android): Update to Firebase Android BoM version 32.8.1.
Expand Down
3 changes: 2 additions & 1 deletion storage/src/ios/storage_reference_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,12 @@
// Cache a copy of the impl and storage, in case this is destroyed before the thread runs.
FIRStorageReference* my_impl = impl();
StorageInternal* storage = storage_;
NSURL* local_file_url = [NSURL URLWithString:@(path)];
util::DispatchAsyncSafeMainQueue(^() {
FIRStorageDownloadTask *download_task;
{
MutexLock mutex(controller_init_mutex_);
download_task = [my_impl writeToFile:[NSURL URLWithString:@(path)] completion:completion];
download_task = [my_impl writeToFile:local_file_url completion:completion];
local_controller->AssignTask(storage, download_task);
}
if (listener) {
Expand Down
Loading