swc icon indicating copy to clipboard operation
swc copied to clipboard

swc_css_parser stuck freeze and cause memory leak when compile quoted class name in :global

Open stormslowly opened this issue 1 year ago • 2 comments

Describe the bug

when compile the code bellow, program freezed and consuming lots memory. image after change :global('.b') -> :global(.b), there is no error.

the instrument result shows the loop causes lot of memory image

Input code

.a {
  :global('.b') {
    color: red;
  }
}

Config

No response

Playground link (or link to the minimal reproduction)

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=53cb34370e12c1c4640394b2ae207e5f

SWC Info output

No response

Expected behavior

compiles OK

Actual behavior

memory leak

Version

0.90.23

Additional context

No response

stormslowly avatar Mar 21 '24 10:03 stormslowly

Try to write:

.a {
  :global(.b) {
    color: red;
  }
}

alexander-akait avatar Mar 21 '24 10:03 alexander-akait

i know that, it should report wrong syntax, but not stuck the whole program.

stormslowly avatar Mar 21 '24 10:03 stormslowly