ably / ably-asset-tracking-swift

iOS client SDKs for the Ably Asset Tracking service.
Apache License 2.0
9 stars 6 forks source link

Sanitize and validate mapbox locations #521

Closed JakubJankowski closed 1 year ago

JakubJankowski commented 1 year ago

Resolves #520

More details in the linked issue, but in short - location update data received from Mapbox can contain invalid values that could potentially cause crashes (infinite value for speed etc.)

This PR adds a mechanism for sanitizing and validating this data, so that where possible all the non-critical parts of a location update get assigned a default -1 value (which is a value that the docs for the CoreLocation's CLLocation expect in cases like this).

If a critical part of a location update is invalid (latitude, longitude, altitude or a timestamp), then we "swallow" that update and log an event, instead of risking crashes.