Skip to content

[Bug report] GMS Barcode scanning crash native 100% on some image resolution/ratio #992

@ninh-huynh

Description

@ninh-huynh

Describe the bug

Our app currently experiences a high number of native crashes on production. On Firebase Crashlytics, the stacktrace is like this

          Crashed: Thread: SIGABRT  0x0000000000000000
#00 pc 0x6ec48 libc.so (BuildId: fa6ae44f4b2b6a34abebf1b3983cbf88)
#01 pc 0x6ec20 libc.so (BuildId: fa6ae44f4b2b6a34abebf1b3983cbf88)
#02 pc 0x1228d4 libbarhopper_v3.so (BuildId: 8d12baa81fff4118463416cb66639c20)
#03 pc 0x126454 libbarhopper_v3.so (BuildId: 8d12baa81fff4118463416cb66639c20)
#04 pc 0x126694 libbarhopper_v3.so (BuildId: 8d12baa81fff4118463416cb66639c20)
#05 pc 0xc96fc libbarhopper_v3.so (BuildId: 8d12baa81fff4118463416cb66639c20)

After some investigation, we can reproduce the crash 100%. It seems that some bitmap resolution/ratio would cause this native crash. (For example, 1366 x 32)

Here is the stacktrace from logcat

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/r9sxxx/r9s:16/BP2A.250605.031.A3/G990EXXSKHYK2:user/release-keys'
Revision: '18'
ABI: 'arm64'
Processor: '5'
Timestamp: 2025-12-17 16:17:30.251047104+0700
Process uptime: 123s
Cmdline: com.zing.zalo
pid: 9185, tid: 9465, name: DefaultDispatch  >>> com.zing.zalo <<<
uid: 10881
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
    x0  0000000000000000  x1  00000000000024f9  x2  0000000000000006  x3  00000073d28aa6a0
    x4  62601f72681f785e  x5  62601f72681f785e  x6  62601f72681f785e  x7  7f7f7f7f7f7f7f7f
    x8  00000000000000f0  x9  febc7d0162589489  x10 000000ff00000020  x11 000000778e9f3020
    x12 0000000000000007  x13 00000013f46f8a68  x14 000f945cb128a8d0  x15 0000000026762762
    x16 0000007760ce70d8  x17 0000007760ccfc40  x18 0000000000000000  x19 00000000000023e1
    x20 00000000000024f9  x21 00000000ffffffff  x22 00000072b0c505e0  x23 000000000000056f
    x24 000000000000056f  x25 00000075a12c9cc0  x26 0000000000000007  x27 0000000000000140
    x28 0000000000000001  x29 00000073d28aa720
    lr  0000007760c6ec24  sp  00000073d28aa6a0  pc  0000007760c6ec48  pst 0000000000001000
2 total frames
backtrace:
  NOTE: Function names and BuildId information is missing for some frames due
  NOTE: to unreadable libraries. For unwinds of apps, only shared libraries
  NOTE: found under the lib/ directory are readable.
  NOTE: On this device, run setenforce 0 to make the libraries readable.
  NOTE: Unreadable libraries:
  NOTE:   /data/user_de/0/com.google.android.gms/app_chimera/m/00000ac7/dl-VisionBarcode.optional_254730100400.apk
      #00 pc 000000000006ec48  /apex/com.android.runtime/lib64/bionic/libc.so (abort+156) (BuildId: fa6ae44f4b2b6a34abebf1b3983cbf88)
      #01 pc 00000000001228d4  /data/user_de/0/com.google.android.gms/app_chimera/m/00000ac7/dl-VisionBarcode.optional_254730100400.apk (offset 0x4b0000)

To Reproduce

  1. Create a new bitmap with size 1366 x 32
  2. Scan the bitmap by using MLKit Barcode scanning API

Code snippet that be able to reproduce 100% the crash

val options = BarcodeScannerOptions.Builder()
            .setBarcodeFormats(Barcode.FORMAT_QR_CODE)
            .build()

val scanner = BarcodeScanning.getClient(options)

val bitmap = createBitmap(1366, 32, Bitmap.Config.ARGB_8888)

val task = scanner.process(bitmap, 0) // <== Crash
val result = Tasks.await(task)
scanner.close()

Expected behavior
Scanner return result with empty list (without any native crash)

SDK Info:

  • com.google.android.gms:play-services-mlkit-barcode-scanning:18.2.0

Smartphone:

  • Device/Simulator: Samsung S21 FE
  • Device/Simulator OS: Android 16 (API 36)

Development Environment:
N/A

Issue tracker:
https://issuetracker.google.com/issues/469479973

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions