parcel-bundler / parcel-bundler/lightningcss

Segmentation fault 11

Open
#910 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
7.7k
Forks
302
PR merge metrics
No merged PRs in 30d

Description

Hi @devongovett! I'm an engineer at Webflow and we're also using lightningcss (thank you! 🙏) to help bundle our user's css. We had a report that one of our user's CSS is causing a Segmentation fault 11 error on our server, and found that it's related to some calc usage:

You can see it erroring on the playground here:

https://lightningcss.dev/playground/index.html#%7B%22minify%22%3Atrue%2C%22customMedia%22%3Atrue%2C%22cssModules%22%3Afalse%2C%22analyzeDependencies%22%3Afalse%2C%22targets%22%3A%7B%7D%2C%22include%22%3A0%2C%22exclude%22%3A0%2C%22source%22%3A%22.my-class%20%7B%5Cn%5Ctdisplay%3A%20block%3B%5Cn%5Ctbackground-color%3A%20var(--transparent)%3B%5Cn%5Cttransform%3A%20translate(15%25%2C%200px)%20rotate(-90deg)%3B%5Cn%5Ctwidth%3A%20calc(100dvh%20-%2010.5rem)%3B%5Cn%20%20%20%20%2F*%20uncomment%20below%20to%20break%20*%2F%5Cn%20%20%5Cn%5Ct%2F*%20height%3A%20calc((100dvh%20-%2010.5rem)%20%2B%20(4vh%20%2B%20230px))%3B%20*%2F%20%5Cn%7D%22%2C%22visitorEnabled%22%3Afalse%2C%22visitor%22%3A%22%7B%5Cn%20%20Color(color)%20%7B%5Cn%20%20%20%20if%20(color.type%20%3D%3D%3D%20'rgb')%20%7B%5Cn%20%20%20%20%20%20color.g%20%3D%200%3B%5Cn%20%20%20%20%20%20return%20color%3B%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%22%2C%22unusedSymbols%22%3A%5B%5D%2C%22version%22%3A%22local%22%7D

We're on version 1.24.1, but it seems to be occurring on the latest as well. This is the snippet:

.my-class {
	display: block;
	background-color: var(--transparent);
	transform: translate(15%, 0px) rotate(-90deg);
	width: calc(100dvh - 10.5rem);
    /* uncomment below to break */
  
	/* height: calc((100dvh - 10.5rem) + (4vh + 230px)); */ 
}

I saw that you've pushed a commit to fix related issues, but it seems like it also needs to be able to handle parens to group operations. Let me know if you'd like additional information, and thank you for this awesome library!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash in the lightningcss playground using the provided CSS, then inspect the referenced commit and the calc parsing and minification paths. Done means the parenthesized calc expression no longer causes a segmentation fault and a regression test covers this input.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.