Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Crash when downloading a large data URI #5217

Closed
MarcLeclair opened this issue Dec 2, 2019 · 2 comments · Fixed by #7136
Closed

Crash when downloading a large data URI #5217

MarcLeclair opened this issue Dec 2, 2019 · 2 comments · Fixed by #7136
Assignees
Labels
🐞 bug Something isn't working <download> Component: feature-download
Milestone

Comments

@MarcLeclair
Copy link
Contributor

MarcLeclair commented Dec 2, 2019

Steps to reproduce

  1. Launch sample-browser.
  2. Open a website that redirects using a data URI. The one I used was: https://mars.nasa.gov/participate/send-your-name/mars2020/certificate/599173796266
  3. Click download

Expected behavior

If the Data URI is an image, a dialogue should pop up to ask the user if they want to download the image.

Actual behavior

Application crashes with a TransactionTooLargeException

Device information

  • Android device: Google Pixel 3(Android 10).

Notes

The application redirects because ( from what I can gather), we check for the "new" url hostname versus our session, which in this case will be different. From there, we redirect with an intent. In the example above, the picture on the NASA website is ~1.2MB which will lead to the application trying to send an intent that's too big (data parcel size 3473380 bytes in my case).

┆Issue is synchronized with this Jira Task

@MarcLeclair MarcLeclair changed the title Webpage gets redirected when given an image Data URI and crashes if the URI is too big.. Webpage gets redirected when given an image Data URI and crashes if the URI is too big. Dec 2, 2019
@jonalmeida jonalmeida added <app-links> Component: feature-app-links 🐞 bug Something isn't working labels Dec 3, 2019
@jonalmeida
Copy link
Contributor

cc: @rocketsroger for reference.

@csadilek csadilek changed the title Webpage gets redirected when given an image Data URI and crashes if the URI is too big. Crash when downloading a large data URI May 19, 2020
@csadilek csadilek added <download> Component: feature-download and removed <app-links> Component: feature-app-links labels May 19, 2020
@csadilek
Copy link
Contributor

Removing the app-link label. This is no longer redirecting, but crashing because we're storing the data URI in the download object which passed as intent extras:

 java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 1486032 bytes
        at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1621)
        at android.app.ContextImpl.startService(ContextImpl.java:1571)
        at android.content.ContextWrapper.startService(ContextWrapper.java:669)
        at mozilla.components.feature.downloads.manager.FetchDownloadManager.download(FetchDownloadManager.kt:8)
        at mozilla.components.feature.downloads.DownloadsFeature.access$processDownload(DownloadsFeature.kt:16)
        at mozilla.components.feature.downloads.DownloadsFeature$start$2$invokeSuspend$$inlined$collect$1.emit(Collect.kt:4)
        at mozilla.components.support.ktx.kotlinx.coroutines.flow.FlowKt$ifChanged$$inlined$filter$1$2.emit(Collect.kt:7)
        at mozilla.components.feature.downloads.DownloadsFeature$start$2$invokeSuspend$$inlined$mapNotNull$1$2.emit(Collect.kt:6)
        at kotlinx.coroutines.CoroutineScopeKt.emitAllImpl$FlowKt__ChannelsKt(CoroutineScope.kt:14)
        at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Unknown Source:11)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:2)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:19)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

csadilek added a commit to csadilek/android-components that referenced this issue May 19, 2020
csadilek added a commit to csadilek/android-components that referenced this issue May 19, 2020
bors bot pushed a commit that referenced this issue May 19, 2020
7028: Issue #5217: Skip check to open about/data/js URLs in external apps r=rocketsroger a=csadilek

This prevents looking up external apps for `data:`, `javascript:` and `about:` URLs. We don't need to look for external apps in these cases and the former actually causes crashes when the URL is too large `TransactionTooLargeException` as the intent contains the entire URL.


Co-authored-by: Christian Sadilek <[email protected]>
@csadilek csadilek self-assigned this May 26, 2020
csadilek added a commit to csadilek/android-components that referenced this issue May 26, 2020
csadilek added a commit to csadilek/android-components that referenced this issue May 27, 2020
csadilek added a commit to csadilek/android-components that referenced this issue May 27, 2020
csadilek added a commit to csadilek/android-components that referenced this issue May 27, 2020
csadilek added a commit to csadilek/android-components that referenced this issue May 27, 2020
csadilek added a commit to csadilek/android-components that referenced this issue May 28, 2020
csadilek added a commit to csadilek/android-components that referenced this issue May 28, 2020
csadilek added a commit to csadilek/android-components that referenced this issue May 28, 2020
@csadilek csadilek added this to the 44.0.0 milestone May 28, 2020
@bors bors bot closed this as completed in 539d368 May 28, 2020
Vishwa-Mozilla pushed a commit to Vishwa-Mozilla/android-components that referenced this issue Jun 5, 2020
Vishwa-Mozilla pushed a commit to Vishwa-Mozilla/android-components that referenced this issue Jun 12, 2020
Vishwa-Mozilla pushed a commit to Vishwa-Mozilla/android-components that referenced this issue Jun 12, 2020
Vishwa-Mozilla pushed a commit to Vishwa-Mozilla/android-components that referenced this issue Jun 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐞 bug Something isn't working <download> Component: feature-download
Projects
None yet
3 participants