Skip to content

Qr-code-login crash #8415

Description

@jkrude

Steps to reproduce

  1. Clear all permissions / or install the app
  2. Login via QR-Code
  3. Choose a picture instead of using the camera

Expected behaviour

  • The picture should be analyzed by the third-party qr-scanner

Actual behaviour

  • A crash occurs due to missing permissions:
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { dat=content://com.android.providers.media.documents/document/image:225036 flg=0x1 }}
to activity {com.nextcloud.client/com.blikoon.qrcodescanner.QrCodeActivity}:

java.lang.SecurityException: Permission Denial: 
reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=20754, uid=10420 
requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()

Suggested solution

  • The crash occurs because QrCodeActivity tries to read from external storage but doesn't ensure the necessary permissions.
  • I opened a PR with a possible solution here.
  • It is arguably a bug in the imported library and not within this app, but I wanted to point out the consequences.

P.S. I really hope this was not reported before, at least I couldn't find anything

Environment data

Android version: SDK 28 Release 9

Device model: LG-H870

Nextcloud app version: 30160090

Nextcloud log (data/nextcloud.log)

******** CAUSE OF ERROR ********

java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { dat=content://com.android.providers.media.documents/document/image:225036 flg=0x1 }} to activity {com.nextcloud.client/com.blikoon.qrcodescanner.QrCodeActivity}: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=20754, uid=10420 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
 at android.app.ActivityThread.deliverResults(ActivityThread.java:4544)
 at android.app.ActivityThread.handleSendResult(ActivityThread.java:4586)
 at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
 at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
 at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1864)
 at android.os.Handler.dispatchMessage(Handler.java:106)
 at android.os.Looper.loop(Looper.java:205)
 at android.app.ActivityThread.main(ActivityThread.java:6991)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:884)
Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=20754, uid=10420 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
 at android.os.Parcel.createException(Parcel.java:1950)
 at android.os.Parcel.readException(Parcel.java:1918)
 at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
 at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
 at android.content.ContentProviderProxy.query(ContentProviderNative.java:418)
 at android.content.ContentResolver.query(ContentResolver.java:804)
 at android.content.ContentResolver.query(ContentResolver.java:753)
 at android.content.ContentResolver.query(ContentResolver.java:711)
 at com.blikoon.qrcodescanner.QrCodeActivity.getPathFromUri(QrCodeActivity.java:386)
 at com.blikoon.qrcodescanner.QrCodeActivity.onActivityResult(QrCodeActivity.java:370)
 at android.app.Activity.dispatchActivityResult(Activity.java:7477)
 at android.app.ActivityThread.deliverResults(ActivityThread.java:4537)
 ... 11 more

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions