Closed Bug 1998106 Opened 5 months ago Closed 5 months ago

Infinity fallback value in anchor() crashes the tab

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Points:
1

Tracking

()

VERIFIED FIXED
146 Branch
Tracking Status
firefox146 --- verified
firefox147 --- verified

People

(Reporter: nchevobbe, Assigned: dshin)

References

(Blocks 1 open bug)

Details

(Whiteboard: [anchorpositioning:m2], [wptsync upstream])

Crash Data

Attachments

(2 files)

(From https://mastodon.social/@Meyerweb/115489174135492911)

Steps to reproduce

  1. Open attached document

Actual results

The page crashes


Here's the CSS

.anchor {
  anchor-name: --infobox;
}

.positionedElement {
  position: absolute;
  position-anchor: --infobox;
  left: calc(anchor(top, Infinity) + 10px);
}

It turns out this happens with more than just Infinity. For example, I tested the above but changed line 11 to read:

      left: calc(anchor(top, 0) + 10px);

Once more tab still crashed. However, with this change to line 11:

      left: calc(anchor(top, 1px) + 10px);

…the tab did not crash. In a limited test of other non-zero length values, I was unable to get another crash. Indeed, even this was rendered without any issue:

      left: calc(anchor(top, calc(1em - 1em)) + 10px);

Just a bit more info: I tried this for line 11, and got a crash:

      left: calc(anchor(top, calc(0)) + 10px);

When I added a unit, the crash went away:

      left: calc(anchor(top, calc(0px)) + 10px);

I could even change the unit to em or q and still avoid the crash. Fascinating!

Okay, last one, I swear. This also avoided a crash:

      left: anchor(top, 0px);

So the problem is maybe due to a unitless value in the fallback?

Severity: -- → S3
Whiteboard: [anchorpositioning:triage]
Assignee: nobody → dshin
Status: NEW → ASSIGNED
Points: --- → 1
Whiteboard: [anchorpositioning:triage] → [anchorpositioning:m2]
Pushed by dshin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/c55071f4ec2e https://hg.mozilla.org/integration/autoland/rev/c6034d39deb7 Ensure that <number> fallbacks are disallowed in fallbacks for anchor functions in calc() functions. r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/55917 for changes under testing/web-platform/tests
Whiteboard: [anchorpositioning:m2] → [anchorpositioning:m2], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 146 Branch
Upstream PR merged by moz-wptsync-bot
Upstream PR merged by moz-wptsync-bot
QA Whiteboard: [qa-triage-done-c147/b146][qa-ver-needed-c147/b146]
Flags: qe-verify+
QA Contact: oardelean

Reproducible on a 2025-11-04 Firefox Nightly build on Windows 10.

Verified as fixed on Firefox Nightly 147.0a1 and Firefox 146.02 on Windows 10, Ubuntu 22, macOS 15.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-triage-done-c147/b146][qa-ver-needed-c147/b146] → [qa-triage-done-c147/b146][qa-ver-done-c147/b146]
Flags: qe-verify+
Duplicate of this bug: 1998169

Copying crash signatures from duplicate bugs.

Crash Signature: [@ core::result::unwrap_failed | style::values::computed::length_percentage::CalcLengthPercentage::resolve]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: