Skip to content

Conversation

@antFrancon
Copy link
Owner

Summary:

This PR addresses a potential ArrayIndexOutOfBoundsException in the Android module's permission checking logic.

- results.length > 0 && results[j] == PackageManager.PERMISSION_GRANTED
+ results.length > j && results[j] == PackageManager.PERMISSION_GRANTED

It ensures that we only access the results array when the index j is within bounds, preventing crashes due to invalid array access that have been occurring in the production environment.

Here is the Crashlytics dashboard concerning this type of crash on my app last week (react-native 0.75.4 - old arch):
image

Changelog:

[ANDROID] [FIXED] - Prevent ArrayIndexOutOfBoundsException in permission check

This commit addresses a potential ArrayIndexOutOfBoundsException in the Android module's permission checking logic.

```diff
- results.length > 0 && results[j] == PackageManager.PERMISSION_GRANTED
+ results.length > j && results[j] == PackageManager.PERMISSION_GRANTED
```

This change ensures that we only access the results array when the index j is within bounds, preventing crashes due to invalid array access that have been occurring in the production environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants