Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-4291

Crash in createUserAgentHeader on Android (Port)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • Beryllium
    • 3.0.10
    • C
    • Security Level: Public
    • None
    • 2

    Description

      Creating a replicator causes the following crash on Android 5 to 8 (~20% of all Android devices):

      ```

          • *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
            Build fingerprint: 'Android/sdk_google_phone_x86/generic_x86:5.1.1/LMY48X/6695563:userdebug/test-keys'
            Revision: '0'
            ABI: 'x86'
            pid: 3483, tid: 3502, name: 1.ui >>> com.terwesten.gabriel.cbl_e2e_tests_flutter <<<
            signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
            Abort message: 'stack corruption detected'
            eax 00000000 ebx 00000d9b ecx 00000dae edx 00000006
            esi a209adb8 edi 00000002
            xcs 00000073 xds 0000007b xes 0000007b xfs 00000077 xss 0000007b
            eip b75762e6 ebp 00000dae esp a2099cc0 flags 00200282
            backtrace:
            #00 pc 000742e6 /system/lib/libc.so (tgkill+22)
            #01 pc 0002217b /system/lib/libc.so (pthread_kill+155)
            #02 pc 000239f4 /system/lib/libc.so (raise+36)
            #03 pc 0001bdf4 /system/lib/libc.so (abort+84)
            #04 pc 0001ea60 /system/lib/libc.so (__libc_fatal+32)
            #05 pc 000739fc /system/lib/libc.so (__stack_chk_fail+28)
            #06 pc 000826ce /data/app/com.terwesten.gabriel.cbl_e2e_tests_flutter-1/lib/x86/libcblite.so (createUserAgentHeader()+1486)
            #07 pc 000813d1 /data/app/com.terwesten.gabriel.cbl_e2e_tests_flutter-1/lib/x86/libcblite.so (cbl_internal::ReplicatorConfiguration::ReplicatorConfiguration(CBLReplicatorConfiguration const&)+1489)
            #08 pc 0007d798 /data/app/com.terwesten.gabriel.cbl_e2e_tests_flutter-1/lib/x86/libcblite.so (CBLReplicator::CBLReplicator(CBLReplicatorConfiguration const&)+184)
            #09 pc 0007d60f /data/app/com.terwesten.gabriel.cbl_e2e_tests_flutter-1/lib/x86/libcblite.so (CBLReplicator_Create+95)
            #10 pc 0001a851 /data/app/com.terwesten.gabriel.cbl_e2e_tests_flutter-1/lib/x86/libcblitedart.so (CBLDart_CBLReplicator_Create+513)
            ```

      The problem is that `createUserAgentHeader` only allocates 3 bytes for `ro.build.version.release`, which is not enough for some releases, e.g. `5.0.1`.

      The docs for [ `__system_property_get`|https://android.googlesource.com/platform/bionic/+/7b95807/libc/include/sys/system_properties.h#47] state that a value can have at most `PROP_VALUE_MAX` bytes.

      Attachments

        Issue Links

          Activity

            People

              pasin Pasin Suriyentrakorn
              pasin Pasin Suriyentrakorn
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty