Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

macOS/iOS: Fix rare crash when downloading tiles that returned a 404 #15313

Merged
merged 1 commit into from
Aug 5, 2019

Conversation

kkaefer
Copy link
Contributor

@kkaefer kkaefer commented Aug 5, 2019

We were capturing the reference to an object that could go away when the request was canceled. However, the lambda could still be invoked by NSURLSession, creating a race condition with a resulting crash when the response to a tile request was 404 Not Found.

This fixes #14325 and #9814

We were capturing the reference to an object that could go away when the request was canceled. However, the lambda could still be invoked by NSURLSession, creating a race condition with a resulting crash when the response to a tile request was 404 Not Found.
@kkaefer kkaefer added bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS crash labels Aug 5, 2019
@kkaefer kkaefer requested a review from 1ec5 as a code owner August 5, 2019 12:35
@kkaefer kkaefer requested a review from a team August 5, 2019 12:35
@kkaefer
Copy link
Contributor Author

kkaefer commented Aug 5, 2019

I was unable to come up with a test case that can reliable reproduce this, given that it's a race condition bug, and we can't influence the exact ordering in which NSURLSessions invokes the lambda.

Copy link
Contributor

@julianrex julianrex left a comment

Choose a reason for hiding this comment

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

Looks good - thank you!

@julianrex julianrex added this to the release-queso milestone Aug 5, 2019
@kkaefer kkaefer merged commit c523391 into master Aug 5, 2019
@kkaefer kkaefer deleted the dangling-lambda-capture branch August 5, 2019 14:15
@friedbunny friedbunny added needs changelog Indicates PR needs a changelog entry prior to merging. and removed needs changelog Indicates PR needs a changelog entry prior to merging. labels Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug crash iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[darwin] AddressSanitizer: heap-use-after-free in mbgl::HTTPFileSource::request
3 participants