Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayIndexOutOfBoundsException #675

Open
JChrist opened this issue Nov 22, 2021 · 8 comments
Open

ArrayIndexOutOfBoundsException #675

JChrist opened this issue Nov 22, 2021 · 8 comments

Comments

@JChrist
Copy link

JChrist commented Nov 22, 2021

Description of the problem:

There are quite a few crashes reported in Play Store for Android SDKs 8.1, 9, 10 and 11 (at least).
The stacktrace for Android SDK 11 is the following. For other Android versions, it is the same, with line numbers on OS methods changing and always going through RawImageData.java:33:

java.lang.ArrayIndexOutOfBoundsException: 
  at java.lang.System.arraycopy (System.java:524)
  at com.journeyapps.barcodescanner.RawImageData.cropAndScale (RawImageData.java:33)
  at com.journeyapps.barcodescanner.SourceData.createSource (SourceData.java:12)
  at com.journeyapps.barcodescanner.DecoderThread.createSource (DecoderThread.java:6)
  at com.journeyapps.barcodescanner.DecoderThread.decode (DecoderThread.java:9)
  at com.journeyapps.barcodescanner.DecoderThread.access$000 (DecoderThread.java)
  at com.journeyapps.barcodescanner.DecoderThread$1.handleMessage (DecoderThread.java:12)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:236)
  at android.os.HandlerThread.run (HandlerThread.java:67)

Which library version are you using? E.g. 3.2.0
4.3.0

Which phone/tablet are you using, and which Android version does it run? (e.g. Samsung Galaxy S5,
Android 5.0)

Spotted on Play Store, sample with the stacktrace is Redmi Note 8T Android 11 (SDK 30).
There are a lot of others as well, such as Redmi 6 Android 9 (SDK 28), etc

Does the same happen on other devices or an emulator?
On devices.

Can you reproduce the issue in the sample project included with the library? If not, can you
provide your own sample project or sample code that produces this error?

Unfortunately not, since I'm reporting the crashes collected by Play Store.

In the case of an error do you have a stack trace or adb logs?
For Android 11:

java.lang.ArrayIndexOutOfBoundsException: 
  at java.lang.System.arraycopy (System.java:524)
  at com.journeyapps.barcodescanner.RawImageData.cropAndScale (RawImageData.java:33)
  at com.journeyapps.barcodescanner.SourceData.createSource (SourceData.java:12)
  at com.journeyapps.barcodescanner.DecoderThread.createSource (DecoderThread.java:6)
  at com.journeyapps.barcodescanner.DecoderThread.decode (DecoderThread.java:9)
  at com.journeyapps.barcodescanner.DecoderThread.access$000 (DecoderThread.java)
  at com.journeyapps.barcodescanner.DecoderThread$1.handleMessage (DecoderThread.java:12)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:236)
  at android.os.HandlerThread.run (HandlerThread.java:67)
@ghost
Copy link

ghost commented Dec 21, 2021

Just got quite similar error:

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: src.length=307200 srcPos=306792 dst.length=331776 dstPos=165312 length=576
       at java.lang.System.arraycopy(System.java)
       at com.journeyapps.barcodescanner.RawImageData.cropAndScale(RawImageData.java:43)
       at com.journeyapps.barcodescanner.SourceData.createSource(SourceData.java:125)
       at com.journeyapps.barcodescanner.DecoderThread.createSource(DecoderThread.java:135)
       at com.journeyapps.barcodescanner.DecoderThread.decode(DecoderThread.java:143)
       at com.journeyapps.barcodescanner.DecoderThread.access$000(DecoderThread.java:22)
       at com.journeyapps.barcodescanner.DecoderThread$1.handleMessage(DecoderThread.java:38)
       at android.os.Handler.dispatchMessage(Handler.java:98)
       at android.os.Looper.loop(Looper.java:154)
       at android.os.HandlerThread.run(HandlerThread.java:61)

Which library version are you using? E.g. 3.2.0
3.4.1

Which phone/tablet are you using, and which Android version does it run? (e.g. Samsung Galaxy S5,
Android 5.0)

PAX A920 (smart POS device) running Android 7.1.2

@SayokMajumder
Copy link

We are also facing the same issue:

Lib Version:
zxing_embedded_version = "4.3.0"
zxing_core_version = "3.3.3"

Device:
OnePlus Nord CE 2 Lite 5G

OS Version:
12

Log:

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: src.length=1555200 srcPos=1555303 dst.length=724546 dstPos=572470 length=874
       at java.lang.System.arraycopy(System.java:522)
       at com.journeyapps.barcodescanner.RawImageData.cropAndScale(RawImageData.java:214)
       at com.journeyapps.barcodescanner.SourceData.createSource(SourceData.java:214)
       at com.journeyapps.barcodescanner.DecoderThread.createSource(DecoderThread.java:214)
       at com.journeyapps.barcodescanner.DecoderThread.decode(DecoderThread.java:214)
       at com.journeyapps.barcodescanner.DecoderThread.access$000(DecoderThread.java:214)
       at com.journeyapps.barcodescanner.DecoderThread$1.handleMessage(DecoderThread.java:214)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loopOnce(Looper.java:238)
       at android.os.Looper.loop(Looper.java:349)
       at android.os.HandlerThread.run(HandlerThread.java:67) 

@shanky367
Copy link

I also faced the same issue while using zxing lib.
Lib Version:
zxing_embedded_version = "4.3.0"
zxing_core_version = "3.3.3"

Device:
OnePlus Nord CE 2 Lite 5G
OS Version:
12

Log:
Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: src.length=1555200 srcPos=1555303 dst.length=724546 dstPos=572470 length=874
at java.lang.System.arraycopy(System.java:522)
at com.journeyapps.barcodescanner.RawImageData.cropAndScale(RawImageData.java:214)
at com.journeyapps.barcodescanner.SourceData.createSource(SourceData.java:214)
at com.journeyapps.barcodescanner.DecoderThread.createSource(DecoderThread.java:214)
at com.journeyapps.barcodescanner.DecoderThread.decode(DecoderThread.java:214)
at com.journeyapps.barcodescanner.DecoderThread.access$000(DecoderThread.java:214)
at com.journeyapps.barcodescanner.DecoderThread$1.handleMessage(DecoderThread.java:214)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:238)
at android.os.Looper.loop(Looper.java:349)
at android.os.HandlerThread.run(HandlerThread.java:67)

@Ezyger
Copy link

Ezyger commented Dec 14, 2022

Same problem over here.

Lib Version:
zxing_embedded_version = "4.3.0"
zxing_core_version = "3.3.0"

Device:
OS Version: 10

Motorola: (46%)
Moto G7 Play (42%)
Moto G7 Power (3%)
Moto G8 (<1%)

Xiaomi: (40%)
Redmi Note 8 (39%)
MI 8 Lite (1%)

LGE K22 (13%)

Samsung (<1%)
Galaxy M52 5G
Galaxy A20s (<1%)

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: src.length=768000 srcPos=768015 dst.length=147294 dstPos=74816 length=1169
at java.lang.System.arraycopy(System.java:527)
at com.journeyapps.barcodescanner.RawImageData.cropAndScale(RawImageData.java:43)
at com.journeyapps.barcodescanner.SourceData.createSource(SourceData.java:125)
at com.journeyapps.barcodescanner.DecoderThread.createSource(DecoderThread.java:135)
at com.journeyapps.barcodescanner.DecoderThread.decode(DecoderThread.java:143)
at com.journeyapps.barcodescanner.DecoderThread.access$000(DecoderThread.java:22)
at com.journeyapps.barcodescanner.DecoderThread$1.handleMessage(DecoderThread.java:38)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:225)
at android.os.HandlerThread.run(HandlerThread.java:67)

@JanMisker
Copy link

JanMisker commented Feb 24, 2023

We experience the same, unfortunately not on our own test devices but we do see crash reports with these logs in the PlayStore :(.
Does anyone have a reproducible case for it? Or found a workaround?

@grzesiek2010
Copy link

Hi I'm Grzegorz from ODK Collect
I've just spotted a similar crash report in our app. There is just one instance of it:
image

and here is the stacktrace:

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: src.length=495616 srcPos=495020 dst.length=746496 dstPos=151200 length=864
       at java.lang.System.arraycopy(System.java:527)
       at com.journeyapps.barcodescanner.RawImageData.cropAndScale(RawImageData.java:43)
       at com.journeyapps.barcodescanner.SourceData.createSource(SourceData.java:125)
       at com.journeyapps.barcodescanner.DecoderThread.createSource(DecoderThread.java:135)
       at com.journeyapps.barcodescanner.DecoderThread.decode(DecoderThread.java:143)
       at com.journeyapps.barcodescanner.DecoderThread.access$000(DecoderThread.java:22)
       at com.journeyapps.barcodescanner.DecoderThread$1.handleMessage(DecoderThread.java:38)
       at android.os.Handler.dispatchMessage(Handler.java:103)
       at android.os.Looper.loop(Looper.java:251)
       at android.os.HandlerThread.run(HandlerThread.java:67)

We use the newest v4.3.0

@madhumitha998
Copy link

We experience the same, unfortunately not on our own test devices but we do see crash reports with these logs in the PlayStore :(. Does anyone have a reproducible case for it? Or found a workaround?

Same, seeing these errors on sentry.

@Hamoda96
Copy link

have the same problem

Log :

   Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: src.length=495616 srcPos=495020 dst.length=746496 dstPos=151200 length=864
   at java.lang.System.arraycopy(System.java:527)
   at com.journeyapps.barcodescanner.RawImageData.cropAndScale(RawImageData.java:43)
   at com.journeyapps.barcodescanner.SourceData.createSource(SourceData.java:125)
   at com.journeyapps.barcodescanner.DecoderThread.createSource(DecoderThread.java:135)
   at com.journeyapps.barcodescanner.DecoderThread.decode(DecoderThread.java:143)
   at com.journeyapps.barcodescanner.DecoderThread.access$000(DecoderThread.java:22)
   at com.journeyapps.barcodescanner.DecoderThread$1.handleMessage(DecoderThread.java:38)
   at android.os.Handler.dispatchMessage(Handler.java:103)
   at android.os.Looper.loop(Looper.java:251)
   at android.os.HandlerThread.run(HandlerThread.java:67)

Mobile info :

Screenshot from 2024-02-19 01-20-41

what is the soluation for this crash ?

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

No branches or pull requests

8 participants