Skip to content

Excessive Looping Due to Missing Longitude Validation in Location.shared.cs #27774

@Digi3-SN

Description

@Digi3-SN

Description

The constructor of the Location class in Location.shared.cs correctly validates latitude values and throws an ArgumentOutOfRangeException if they are invalid. However, for longitude values, it attempts a correction within a while loop without validating whether the value is within a valid range. This can lead to excessive iterations and block the application for a long time.

Steps to Reproduce

Attempt to initialize a Location object with a valid latitude but an excessively large longitude value.
Example scenario: Our database contained a longitude value with 17 decimal places.

Expected Behavior
An ArgumentOutOfRangeException should be thrown for an invalid longitude value, similar to latitude validation.

Actual Behavior
The while loop runs for an extended period, causing the application to hang.

Proposed Fix

Add proper validation for longitude values before attempting corrections. If the value is out of range, throw an ArgumentOutOfRangeException instead of relying on the loop for correction.

Link to public reproduction project repository

No response

Version with bug

9.0.40 SR4

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

Proper Input Validation

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-essentialsEssentials: Device, Display, Connectivity, Secure Storage, Sensors, App Infogood first issueGood for newcomersplatform/androidt/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions