wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.92k stars 1.3k forks source link

Fixes Aztec IndexOutOfBoundsException #20518

Closed antonis closed 1 month ago

antonis commented 1 month ago

Fixes https://github.com/wordpress-mobile/WordPress-Android/issues/20481

Related PRs:


Description

This PR adds exception handling for an IndexOutOfBoundsException thrown from the SpannableStringBuilder when the requested character position >= length on some occasions.

To Test:

See https://github.com/wordpress-mobile/AztecEditor-Android/pull/1078


Regression Notes

  1. Potential unintended areas of impact

    • Editor
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

    • Manual testing
  3. What automated tests I added (or what prevented me from doing so)

    • The change is in AztecEditor-Android

PR Submission Checklist:


Testing Checklist (strike-out the not-applying and unnecessary ones):

wpmobilebot commented 1 month ago
WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr20518-42f9b62
Commit42f9b62386c5c2085b2fc666958934910abaa877
Direct Downloadwordpress-prototype-build-pr20518-42f9b62.apk
Note: Google Login is not supported on these builds.
wpmobilebot commented 1 month ago
Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr20518-42f9b62
Commit42f9b62386c5c2085b2fc666958934910abaa877
Direct Downloadjetpack-prototype-build-pr20518-42f9b62.apk
Note: Google Login is not supported on these builds.
sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

wpmobilebot commented 1 month ago

Found 1 violations:

The PR caused some dependency changes (expand to see details)

```diff \--- project :libs:editor - +--- org.wordpress:aztec:{strictly v2.1.0} -> v2.1.0 + +--- org.wordpress:aztec:{strictly v2.1.1} -> v2.1.1 - +--- org.wordpress.aztec:wordpress-shortcodes:{strictly v2.1.0} -> v2.1.0 - | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -> 1.9.10 (*) - | +--- org.wordpress:aztec:v2.1.0 (*) - | \--- androidx.appcompat:appcompat:1.0.0 -> 1.6.1 (*) + +--- org.wordpress.aztec:wordpress-shortcodes:{strictly v2.1.1} -> v2.1.1 + | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -> 1.9.10 (*) + | +--- org.wordpress:aztec:v2.1.1 (*) + | \--- androidx.appcompat:appcompat:1.0.0 -> 1.6.1 (*) - +--- org.wordpress.aztec:wordpress-comments:{strictly v2.1.0} -> v2.1.0 - | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -> 1.9.10 (*) - | +--- org.wordpress:aztec:v2.1.0 (*) - | +--- androidx.legacy:legacy-support-v4:1.0.0 (*) - | \--- com.google.android.material:material:1.0.0 -> 1.9.0 (*) + +--- org.wordpress.aztec:wordpress-comments:{strictly v2.1.1} -> v2.1.1 + | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -> 1.9.10 (*) + | +--- org.wordpress:aztec:v2.1.1 (*) + | +--- androidx.legacy:legacy-support-v4:1.0.0 (*) + | \--- com.google.android.material:material:1.0.0 -> 1.9.0 (*) - \--- org.wordpress.gutenberg-mobile:react-native-gutenberg-bridge:v1.116.0-alpha1 - +--- com.facebook.fresco:animated-gif:2.0.0 - | +--- com.parse.bolts:bolts-tasks:1.4.0 - | +--- com.facebook.soloader:soloader:0.6.0 -> 0.10.5 (*) - | +--- com.facebook.fresco:fbcore:2.0.0 -> 3.1.3 (*) - | \--- com.facebook.fresco:animated-base:2.0.0 - | +--- com.facebook.fresco:fbcore:2.0.0 -> 3.1.3 (*) - | +--- com.facebook.fresco:imagepipeline-base:2.0.0 -> 3.1.3 (*) - | +--- com.facebook.fresco:imagepipeline:2.0.0 -> 3.1.3 (*) - | +--- com.facebook.fresco:animated-drawable:2.0.0 - | | +--- com.facebook.fresco:imagepipeline:2.0.0 -> 3.1.3 (*) - | | +--- com.facebook.fresco:drawee:2.0.0 -> 3.1.3 (*) - | | \--- com.facebook.fresco:fbcore:2.0.0 -> 3.1.3 (*) - | \--- com.parse.bolts:bolts-tasks:1.4.0 - +--- com.google.android.material:material:1.2.1 -> 1.9.0 (*) - +--- com.github.wordpress-mobile:react-native-video:5.2.0-wp-6 - | +--- com.google.android.exoplayer:exoplayer:2.13.3 - | | +--- com.google.android.exoplayer:exoplayer-core:2.13.3 - | | | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) - | | | +--- com.google.android.exoplayer:exoplayer-common:2.13.3 - | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) - | | | | \--- com.google.guava:guava:27.1-android - | | | | +--- com.google.guava:failureaccess:1.0.1 - | | | | \--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava - | | | \--- com.google.android.exoplayer:exoplayer-extractor:2.13.3 - | | | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) - | | | \--- com.google.android.exoplayer:exoplayer-common:2.13.3 (*) - | | +--- com.google.android.exoplayer:exoplayer-dash:2.13.3 - | | | +--- com.google.android.exoplayer:exoplayer-core:2.13.3 (*) - | | | \--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) - | | +--- com.google.android.exoplayer:exoplayer-hls:2.13.3 - | | | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) - | | | \--- com.google.android.exoplayer:exoplayer-core:2.13.3 (*) - | | +--- com.google.android.exoplayer:exoplayer-smoothstreaming:2.13.3 - | | | +--- com.google.android.exoplayer:exoplayer-core:2.13.3 (*) - | | | \--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) - | | +--- com.google.android.exoplayer:exoplayer-transformer:2.13.3 - | | | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) - | | | \--- com.google.android.exoplayer:exoplayer-core:2.13.3 (*) - | | \--- com.google.android.exoplayer:exoplayer-ui:2.13.3 - | | +--- com.google.android.exoplayer:exoplayer-core:2.13.3 (*) - | | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) - | | +--- androidx.recyclerview:recyclerview:1.1.0 -> 1.3.0 (*) - | | \--- androidx.media:media:1.2.1 (*) - | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) - | +--- androidx.core:core:1.1.0 -> 1.12.0 (*) - | +--- androidx.media:media:1.1.0 -> 1.2.1 (*) - | +--- com.google.android.exoplayer:extension-okhttp:2.13.3 - | | +--- com.google.android.exoplayer:exoplayer-common:2.13.3 (*) - | | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) - | | \--- com.squareup.okhttp3:okhttp:3.12.11 -> 4.11.0 (*) - | \--- com.squareup.okhttp3:okhttp:${OKHTTP_VERSION} -> 4.11.0 (*) - +--- com.github.wordpress-mobile:react-native-slider:3.0.2-wp-4 - +--- org.wordpress.react-native-libraries.v5:react-native-get-random-values:1.4.0 - +--- org.wordpress.react-native-libraries.v5:react-native-safe-area-context:4.8.2 - | \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.21 -> 1.9.22 (*) - +--- org.wordpress.react-native-libraries.v5:react-native-screens:3.29.0 - | +--- androidx.appcompat:appcompat:1.6.1 (*) - | +--- androidx.fragment:fragment:1.3.6 -> 1.6.2 (*) - | +--- androidx.coordinatorlayout:coordinatorlayout:1.2.0 (*) - | +--- androidx.swiperefreshlayout:swiperefreshlayout:1.1.0 (*) - | +--- com.google.android.material:material:1.9.0 (*) - | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) - | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.21 -> 1.9.10 (*) - | \--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1 -> 2.6.2 (c) - +--- org.wordpress.react-native-libraries.v5:react-native-svg:14.0.0 - +--- org.wordpress.react-native-libraries.v5:react-native-webview:13.6.1 - | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.21 -> 1.9.22 (*) - | \--- androidx.webkit:webkit:1.4.0 -> 1.10.0 (*) - +--- org.wordpress.react-native-libraries.v5:react-native-masked-view:0.3.0 - +--- org.wordpress.react-native-libraries.v5:react-native-clipboard:1.11.2 - +--- org.wordpress.react-native-libraries.v5:react-native-fast-image:8.5.11 - | +--- com.github.bumptech.glide:glide:4.12.0 -> 4.16.0 - | | +--- com.github.bumptech.glide:gifdecoder:4.16.0 - | | | \--- androidx.annotation:annotation:1.5.0 -> 1.6.0 (*) - | | +--- com.github.bumptech.glide:disklrucache:4.16.0 - | | +--- com.github.bumptech.glide:annotations:4.16.0 - | | +--- androidx.fragment:fragment:1.3.6 -> 1.6.2 (*) - | | +--- androidx.vectordrawable:vectordrawable-animated:1.1.0 (*) - | | +--- androidx.exifinterface:exifinterface:1.3.6 (*) - | | \--- androidx.tracing:tracing:1.0.0 -> 1.1.0 (*) - | \--- com.github.bumptech.glide:okhttp3-integration:4.12.0 - | +--- com.github.bumptech.glide:glide:4.12.0 -> 4.16.0 (*) - | +--- com.squareup.okhttp3:okhttp:3.9.1 -> 4.11.0 (*) - | \--- androidx.annotation:annotation:1.0.0 -> 1.6.0 (*) - +--- org.wordpress.react-native-libraries.v5:react-native-reanimated:3.6.2 - | +--- com.facebook.yoga:proguard-annotations:1.19.0 - | +--- androidx.transition:transition:1.1.0 -> 1.4.1 (*) - | \--- androidx.core:core:1.9.0 -> 1.12.0 (*) - +--- org.wordpress.react-native-libraries.v5:react-native-gesture-handler:2.14.1 - | +--- org.wordpress.react-native-libraries.v5:react-native-reanimated:3.6.2 (*) - | +--- androidx.appcompat:appcompat:1.6.1 (*) - | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) - | \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.21 -> 1.9.22 (*) - +--- org.wordpress.react-native-libraries.v5:react-native-linear-gradient:2.7.3 - +--- org.wordpress.gutenberg-mobile:react-native-aztec:v1.116.0-alpha1 - | +--- androidx.legacy:legacy-support-v4:1.0.0 (*) - | +--- androidx.gridlayout:gridlayout:1.0.0 - | | +--- androidx.core:core:1.0.0 -> 1.12.0 (*) - | | \--- androidx.legacy:legacy-support-core-ui:1.0.0 (*) - | +--- androidx.cardview:cardview:1.0.0 (*) - | +--- androidx.appcompat:appcompat:1.2.0 -> 1.6.1 (*) - | +--- androidx.recyclerview:recyclerview:1.1.0 -> 1.3.0 (*) - | +--- org.wordpress:aztec:v2.1.0 (*) - | +--- org.wordpress.aztec:wordpress-shortcodes:v2.1.0 (*) - | +--- org.wordpress.aztec:wordpress-comments:v2.1.0 (*) - | +--- org.wordpress.aztec:glide-loader:v2.1.0 - | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -> 1.9.10 (*) - | | +--- org.wordpress:aztec:v2.1.0 (*) - | | \--- com.github.bumptech.glide:glide:4.10.0 -> 4.16.0 (*) - | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0 -> 1.9.10 (*) - \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0 -> 1.9.10 (*) + \--- org.wordpress.gutenberg-mobile:react-native-gutenberg-bridge:v1.116.0-alpha2 + +--- com.facebook.fresco:animated-gif:2.0.0 + | +--- com.parse.bolts:bolts-tasks:1.4.0 + | +--- com.facebook.soloader:soloader:0.6.0 -> 0.10.5 (*) + | +--- com.facebook.fresco:fbcore:2.0.0 -> 3.1.3 (*) + | \--- com.facebook.fresco:animated-base:2.0.0 + | +--- com.facebook.fresco:fbcore:2.0.0 -> 3.1.3 (*) + | +--- com.facebook.fresco:imagepipeline-base:2.0.0 -> 3.1.3 (*) + | +--- com.facebook.fresco:imagepipeline:2.0.0 -> 3.1.3 (*) + | +--- com.facebook.fresco:animated-drawable:2.0.0 + | | +--- com.facebook.fresco:imagepipeline:2.0.0 -> 3.1.3 (*) + | | +--- com.facebook.fresco:drawee:2.0.0 -> 3.1.3 (*) + | | \--- com.facebook.fresco:fbcore:2.0.0 -> 3.1.3 (*) + | \--- com.parse.bolts:bolts-tasks:1.4.0 + +--- com.google.android.material:material:1.2.1 -> 1.9.0 (*) + +--- com.github.wordpress-mobile:react-native-video:5.2.0-wp-6 + | +--- com.google.android.exoplayer:exoplayer:2.13.3 + | | +--- com.google.android.exoplayer:exoplayer-core:2.13.3 + | | | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) + | | | +--- com.google.android.exoplayer:exoplayer-common:2.13.3 + | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) + | | | | \--- com.google.guava:guava:27.1-android + | | | | +--- com.google.guava:failureaccess:1.0.1 + | | | | \--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava + | | | \--- com.google.android.exoplayer:exoplayer-extractor:2.13.3 + | | | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) + | | | \--- com.google.android.exoplayer:exoplayer-common:2.13.3 (*) + | | +--- com.google.android.exoplayer:exoplayer-dash:2.13.3 + | | | +--- com.google.android.exoplayer:exoplayer-core:2.13.3 (*) + | | | \--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) + | | +--- com.google.android.exoplayer:exoplayer-hls:2.13.3 + | | | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) + | | | \--- com.google.android.exoplayer:exoplayer-core:2.13.3 (*) + | | +--- com.google.android.exoplayer:exoplayer-smoothstreaming:2.13.3 + | | | +--- com.google.android.exoplayer:exoplayer-core:2.13.3 (*) + | | | \--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) + | | +--- com.google.android.exoplayer:exoplayer-transformer:2.13.3 + | | | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) + | | | \--- com.google.android.exoplayer:exoplayer-core:2.13.3 (*) + | | \--- com.google.android.exoplayer:exoplayer-ui:2.13.3 + | | +--- com.google.android.exoplayer:exoplayer-core:2.13.3 (*) + | | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) + | | +--- androidx.recyclerview:recyclerview:1.1.0 -> 1.3.0 (*) + | | \--- androidx.media:media:1.2.1 (*) + | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) + | +--- androidx.core:core:1.1.0 -> 1.12.0 (*) + | +--- androidx.media:media:1.1.0 -> 1.2.1 (*) + | +--- com.google.android.exoplayer:extension-okhttp:2.13.3 + | | +--- com.google.android.exoplayer:exoplayer-common:2.13.3 (*) + | | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*) + | | \--- com.squareup.okhttp3:okhttp:3.12.11 -> 4.11.0 (*) + | \--- com.squareup.okhttp3:okhttp:${OKHTTP_VERSION} -> 4.11.0 (*) + +--- com.github.wordpress-mobile:react-native-slider:3.0.2-wp-4 + +--- org.wordpress.react-native-libraries.v5:react-native-get-random-values:1.4.0 + +--- org.wordpress.react-native-libraries.v5:react-native-safe-area-context:4.8.2 + | \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.21 -> 1.9.22 (*) + +--- org.wordpress.react-native-libraries.v5:react-native-screens:3.29.0 + | +--- androidx.appcompat:appcompat:1.6.1 (*) + | +--- androidx.fragment:fragment:1.3.6 -> 1.6.2 (*) + | +--- androidx.coordinatorlayout:coordinatorlayout:1.2.0 (*) + | +--- androidx.swiperefreshlayout:swiperefreshlayout:1.1.0 (*) + | +--- com.google.android.material:material:1.9.0 (*) + | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) + | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.21 -> 1.9.10 (*) + | \--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1 -> 2.6.2 (c) + +--- org.wordpress.react-native-libraries.v5:react-native-svg:14.0.0 + +--- org.wordpress.react-native-libraries.v5:react-native-webview:13.6.1 + | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.21 -> 1.9.22 (*) + | \--- androidx.webkit:webkit:1.4.0 -> 1.10.0 (*) + +--- org.wordpress.react-native-libraries.v5:react-native-masked-view:0.3.0 + +--- org.wordpress.react-native-libraries.v5:react-native-clipboard:1.11.2 + +--- org.wordpress.react-native-libraries.v5:react-native-fast-image:8.5.11 + | +--- com.github.bumptech.glide:glide:4.12.0 -> 4.16.0 + | | +--- com.github.bumptech.glide:gifdecoder:4.16.0 + | | | \--- androidx.annotation:annotation:1.5.0 -> 1.6.0 (*) + | | +--- com.github.bumptech.glide:disklrucache:4.16.0 + | | +--- com.github.bumptech.glide:annotations:4.16.0 + | | +--- androidx.fragment:fragment:1.3.6 -> 1.6.2 (*) + | | +--- androidx.vectordrawable:vectordrawable-animated:1.1.0 (*) + | | +--- androidx.exifinterface:exifinterface:1.3.6 (*) + | | \--- androidx.tracing:tracing:1.0.0 -> 1.1.0 (*) + | \--- com.github.bumptech.glide:okhttp3-integration:4.12.0 + | +--- com.github.bumptech.glide:glide:4.12.0 -> 4.16.0 (*) + | +--- com.squareup.okhttp3:okhttp:3.9.1 -> 4.11.0 (*) + | \--- androidx.annotation:annotation:1.0.0 -> 1.6.0 (*) + +--- org.wordpress.react-native-libraries.v5:react-native-reanimated:3.6.2 + | +--- com.facebook.yoga:proguard-annotations:1.19.0 + | +--- androidx.transition:transition:1.1.0 -> 1.4.1 (*) + | \--- androidx.core:core:1.9.0 -> 1.12.0 (*) + +--- org.wordpress.react-native-libraries.v5:react-native-gesture-handler:2.14.1 + | +--- org.wordpress.react-native-libraries.v5:react-native-reanimated:3.6.2 (*) + | +--- androidx.appcompat:appcompat:1.6.1 (*) + | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) + | \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.21 -> 1.9.22 (*) + +--- org.wordpress.react-native-libraries.v5:react-native-linear-gradient:2.7.3 + +--- org.wordpress.gutenberg-mobile:react-native-aztec:v1.116.0-alpha2 + | +--- androidx.legacy:legacy-support-v4:1.0.0 (*) + | +--- androidx.gridlayout:gridlayout:1.0.0 + | | +--- androidx.core:core:1.0.0 -> 1.12.0 (*) + | | \--- androidx.legacy:legacy-support-core-ui:1.0.0 (*) + | +--- androidx.cardview:cardview:1.0.0 (*) + | +--- androidx.appcompat:appcompat:1.2.0 -> 1.6.1 (*) + | +--- androidx.recyclerview:recyclerview:1.1.0 -> 1.3.0 (*) + | +--- org.wordpress:aztec:v2.1.1 (*) + | +--- org.wordpress.aztec:wordpress-shortcodes:v2.1.1 (*) + | +--- org.wordpress.aztec:wordpress-comments:v2.1.1 (*) + | +--- org.wordpress.aztec:glide-loader:v2.1.1 + | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -> 1.9.10 (*) + | | +--- org.wordpress:aztec:v2.1.1 (*) + | | \--- com.github.bumptech.glide:glide:4.10.0 -> 4.16.0 (*) + | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0 -> 1.9.10 (*) + \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0 -> 1.9.10 (*) ```

Please review and act accordingly