Expensify / react-native-live-markdown

Drop-in replacement for React Native's TextInput component with Markdown formatting.
https://www.npmjs.com/package/@expensify/react-native-live-markdown
MIT License
668 stars 45 forks source link

Fix "Out of bounds" crash on iOS #409

Closed tomekzaw closed 2 days ago

tomekzaw commented 2 days ago

Details

This PR fixes the following crash on iOS

NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds

when returning improper ranges, in particular:

  1. when passing a range with zero length, e.g. { start: 10, length: 0, type: 'code' }

Screenshot 2024-07-02 at 10 18 43

  1. when passing a range that is longer than the string itself, e.g. { start: 0, length: 9999, type: 'bold' }
Screenshot 2024-07-02 at 10 19 26

Related Issues

GH_LINK

Manual Tests

Linked PRs