stripe-android icon indicating copy to clipboard operation
stripe-android copied to clipboard

[BUG] Image.kt cropCameraPreviewToViewFinder crash

Open alashow opened this issue 1 year ago • 2 comments

Summary

Re-opening #6116, since we're still seeing the crash on latest versions.

Code to reproduce

Simple usage, creating a scanner using CardScanSheet.create. Cannot reproduce this manually, can see instances in Crashlytics (affecting ~125 users, 250 crashes).

Fatal Exception: java.lang.IllegalArgumentException: View finder Rect(0, 0 - 1080, 2195) is outside preview image bounds Rect(-9, 0 - 1089, 2194)
       at com.stripe.android.camera.framework.image.ImageKt.cropCameraPreviewToViewFinder(Image.kt:77)
       at com.stripe.android.stripecardscan.payment.ml.SSDOcr$Companion.cameraPreviewToInput(SSDOcr.kt:124)
       at com.stripe.android.stripecardscan.cardscan.CardScanFlow$startFlow$1$invokeSuspend$lambda$2$lambda$1$$inlined$map$1$2.emit(Emitters.kt:224)
       at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
       at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt)
       at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt:11)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt)

Android version & Impacted devices

Devices: Google, Samsung, Motorola Android versions: Android 10-14 (probably can happen in all though)

Installation method

Gradle dependency

Dependency Versions

Stripe-android 20.35.0 kotlin 1.8.20 AGP 8.2.0 Gradle 8.0.0

SDK classes

CardScanSheet

alashow avatar Feb 12 '24 21:02 alashow

Thanks for the report, I'll be investigating this bug this week.

awush-stripe avatar Mar 11 '24 15:03 awush-stripe

Same issue for me on stripe version 20.37.1 Fatal Exception: java.lang.IllegalArgumentException: View finder Rect(0, 0 - 1080, 2185) is outside preview image bounds Rect(-74, 0 - 1154, 2184) at com.stripe.android.camera.framework.image.ImageKt.cropCameraPreviewToViewFinder(Image.kt:77) at com.stripe.android.stripecardscan.payment.ml.SSDOcr$Companion.cameraPreviewToInput(SSDOcr.java:124) at com.stripe.android.stripecardscan.cardscan.CardScanFlow$startFlow$1$invokeSuspend$lambda$2$lambda$1$$inlined$map$1$2.emit(CardScanFlow.java:224) at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(FlowKt__Channels.kt:37) at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(FlowKt__Channels.kt:1) at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt:12) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

tmgsoftart avatar Mar 15 '24 12:03 tmgsoftart

This should now be resolved. The fix landed and released yesterday as part of 20.44.1. Thank you for your patience on this!

awush-stripe avatar May 29 '24 15:05 awush-stripe