Closed Bug 2006921 Opened 6 months ago Closed 6 months ago

Pasting large images into address bar causes crash with composable toolbar enabled [@ java.lang.RuntimeException: at android.content.ClipboardManager.setPrimaryClip(ClipboardManager.java)]

Categories

(Firefox for Android :: Toolbar, defect, P2)

Firefox 145
Unspecified
Android
defect

Tracking

()

VERIFIED FIXED
148 Branch
Tracking Status
firefox146 --- wontfix
firefox147 --- verified
firefox148 --- verified

People

(Reporter: ke5trel, Assigned: petru)

References

(Regression)

Details

(Keywords: crash, regression, Whiteboard: [fxdroid][group3][composable toolbar])

Crash Data

Attachments

(3 files)

STR:

  1. Ensure "Composable Toolbar" is enabled in secret settings on latest Android Nightly 148.0a1.
  2. Open Gallery app on Samsung S20, select a large photo (at least 4MB), tap three-dots > "Copy to clipboard".
  3. Focus address bar.
  4. Long-press address bar and tap "Paste".

Expected:
Nothing happens or characters pasted like before.

Actual:
App crashes.

Does not happen with composable toolbar disabled but previously worked with it enabled.

Regression window (paste missing):
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=6bcf80824ecafc424e41b136705ba08370d66254&tochange=ebd252259b1b0cb286e12edc2e14b9f483444920

Regression window (paste appears but crashes):
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=d87cd04072b041911d218cec1baf59de7f2a5ede&tochange=2aa1a620ba9a855c06761428259e9e881d8db785

Possibly regressed by Bug 1994009.

Crash report: https://crash-stats.mozilla.org/report/index/a8a04b04-cc23-4aa7-a7db-540710251218

Top 10 frames:

0  android.os.BinderProxy  transactNative  BinderProxy.java:-2
1  android.os.BinderProxy  transact  BinderProxy.java:662
2  android.content.IClipboard$Stub$Proxy  setPrimaryClip  IClipboard.java:311
3  android.content.ClipboardManager  setPrimaryClip  ClipboardManager.java:132
4  androidx.compose.ui.platform.AndroidClipboard  setClipEntry  AndroidClipboard.android.kt:29
5  mozilla.components.compose.browser.toolbar.ui.PasteSanitizerTextToolbar$sanit...  invokeSuspend  InlineAutocompleteTextField.kt:180
6  kotlin.coroutines.jvm.internal.BaseContinuationImpl  resumeWith  ContinuationImpl.kt:9
7  kotlinx.coroutines.DispatchedTask  run  DispatchedTask.kt:122
8  androidx.compose.ui.platform.AndroidUiDispatcher  access$performTrampolineDispatch  AndroidUiDispatcher.android.kt:24
9  androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1  run  AndroidUiDispatcher.android.kt:3

Thank you for the all the details @Kestrel!

Tested that this reproduces with the composable toolbar while it isn't an issue with the new toolbar.

Deobfuscated stack trace from my device:

java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 1515140 bytes
at android.content.ClipboardManager.setPrimaryClip(ClipboardManager.java:192)
at androidx.compose.ui.platform.AndroidClipboard.setClipEntry(AndroidClipboard.android.kt:29)
at mozilla.components.compose.browser.toolbar.ui.PasteSanitizerTextToolbar$sanitizeAvailableTextClip$1.invokeSuspend(InlineAutocompleteTextField.kt:180)

Don't see the value in supporting this or very long URLs, do remember issues with long data URLs also in the past, we should probably catch the exception and prevent it from crashing the app first. Optionally we can show a message to the user about the operation failing.

Severity: -- → S2
Priority: -- → P2
Whiteboard: [fxdroid][group3][composable toolbar]
Assignee: nobody → petru
Status: NEW → ASSIGNED
Pushed by plingurar@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/891d0339fd81 https://hg.mozilla.org/integration/autoland/rev/76825a7d17b2 Coerce max length of pasted text in the addressbar to 2_000 characters r=android-reviewers,Roger
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 148 Branch

The patch landed in nightly and beta is affected.
:petru, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(petru)
Flags: qe-verify+

Managed to reproduce the issue on an earlier Nightly build (148.0a1 from 2025-12-18).

Verified as fixed on the latest Nightly build (148.0a1 from 2025-12-29).

The app does no longer crash on the latest build.

A 34Mb file was used to create the situation that caused the crash before.

Device used: Samsung Galaxy S25 Ultra (Android 15).

Marking the ticket as verified on 148.

Flags: qe-verify+

:petru, 147.0b9 builds on Wednesday and is the last beta for the cycle.
If this is safe for a beta uplift request?

(In reply to Donal Meehan [:dmeehan] from comment #7)

:petru, 147.0b9 builds on Wednesday and is the last beta for the cycle.
If this is safe for a beta uplift request?

Thank you for the ping!
The patch would solve two scenarios of possible crashes through relatively small changes so I think we should have this in preparation of a wider release of the composable toolbar.

Flags: needinfo?(petru)

firefox-beta Uplift Approval Request

  • User impact if declined: Potential crash when pasting large objects in the toolbar or resources owned by other apps - like images.
  • Code covered by automated testing: no
  • Fix verified in Nightly: yes
  • Needs manual QE test: yes
  • Steps to reproduce for manual QE testing: https://bugzilla.mozilla.org/show_bug.cgi?id=2006921#c0
  • Risk associated with taking this patch: low
  • Explanation of risk level: Small targeted fix.
  • String changes made/needed: --
  • Is Android affected?: yes
Attachment #9535068 - Flags: approval-mozilla-beta?
Flags: qe-verify+

Users can still choose "Paste & Go" in the contextual popup menu to load
longer URLs but the length of text pasted to edit is now limited to a more
manageable size.

Original Revision: https://phabricator.services.mozilla.com/D277506

Attachment #9535068 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Managed to reproduce the issue on an earlier Beta build (1470b8).

Verified as fixed on the latest Beta build (147.0b9).

The app does no longer crash on the latest build.

The same 34Mb file was used (As on Nightly verifying) to create the situation that caused the crash before.

Device used: Samsung Galaxy S25 Ultra (Android 15).

Marking the ticket as verified on 147 as well.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: