Closed Bug 1875068 Opened 6 months ago Closed 6 months ago

Opening jar: URI in debug build leads to assertion failure (Failed to create truncated form of URI with NS_NewURI.)

Categories

(Core :: Networking, defect, P2)

defect

Tracking

()

RESOLVED FIXED
124 Branch
Tracking Status
firefox124 --- fixed

People

(Reporter: maltejur, Assigned: maltejur)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(2 files)

Attached file empty.zip

While writing the test for Bug 1824325, which includes opening a jar: URI, I noticed the following problem.

To reproduce:

  1. Open a Firefox debug build (either compile yourself with ac_add_options --enable-debug, grab a binary through mozregression, or use this recent binary)
  2. Prepare any file that can be opened through a jar: uri in a convenient location, for example save the attached empty.zip to /tmp/empty.zip
  3. Open the file from step 2 through a jar: uri, so in my example open jar:file:///tmp/empty.zip!/

Expected behaviour: We see the directory listing of empty.zip

Actual behaviour: Firefox hits a assertion failure and thus freezes. We see the following message in the log:

[Parent 328254, Main Thread] WARNING: jar:///test.txt: file /builds/worker/checkouts/gecko/netwerk/base/LoadInfo.cpp:1574
Assertion failure: false (Failed to create truncated form of URI with NS_NewURI.), at /builds/worker/checkouts/gecko/netwerk/base/LoadInfo.cpp:1576
#01: ???[/home/maltejur/Downloads/firefox/libxul.so +0x392bd20]

Here is a more complete log from my try run for Bug 1824325, including a better stack trace: https://treeherder.mozilla.org/logviewer?job_id=443618530&repo=try&lineNumber=5639.

This assert is triggered: netwerk/base/LoadInfo.cpp#1572,1575-1576. Unfortnuantly we don't see the rv.
These two lines from the treeherder log might be interesting.

[task 2024-01-17T12:35:32.026Z] 12:35:32     INFO - GECKO(1343) | principal: jar:file:///builds/worker/workspace/build/tests/mochitest/browser/netwerk/test/browser/res_empty.zip!/
[task 2024-01-17T12:35:32.027Z] 12:35:32     INFO - GECKO(1343) | uriString: jar:///

Stepping through with gdb might be helpful. Especially with the straight forward steps to reproduce.

Severity: -- → S4
Priority: -- → P2
Whiteboard: [necko-triaged]

Steps to reproduce: Just open jar:file:///C:/Program%20Files/Mozilla%20Firefox/omni.ja!/ with a debug build. (Assuming that Firefox is installed at C:\Program Files\Mozilla Firefox. If not, change the URL accordingly.)
I think we need a special handling for jar: scheme like view-source:.

As jar: uris are forbidden for anything but internal and local sites, they should be safe to exclude from principal truncating. Furthermore, as the current code leads to an assertion, it already isn't truncating the principal.

Assignee: nobody → mjurgens
Status: NEW → ASSIGNED
Pushed by mjurgens@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4f970ce269e2
Exclude jar: uris from principal truncating r=necko-reviewers,valentin
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 124 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: