swc icon indicating copy to clipboard operation
swc copied to clipboard

Multiple crashes when compiling javascript/typescript files

Open qarmin opened this issue 1 year ago • 4 comments
trafficstars

Describe the bug

Using swc compile on this files Untitled Folder.zip More files REPORTS___SWC___LONG_1.zip

causes several crashes/timeouts like

timeout: the monitored command dumped core
thread 'main' panicked at crates/swc_ecma_compat_es2015/src/destructuring.rs:1165:44:
called `Option::unwrap()` on a `None` value
thread 'main' panicked at /home/runner/work/Automated-Fuzzer/Automated-Fuzzer/swc-main/crates/swc_common/src/source_map.rs:662:60:
byte index 6 is not a char boundary; it is inside '\u{feff}' (bytes 4..7) of `void#!shßpublicb`
thread 'main' panicked at crates/swc_ecma_compat_es2021/src/logical_assignments.rs:155:50:
called `Result::unwrap()` on an `Err` value: Invalid(Invalid { span: 0..0#0 })
thread 'main' panicked at crates/swc_ecma_compat_es2015/src/destructuring.rs:409:52:
internal error: entered unreachable code: Object rest pattern should be removed by es2018::object_rest_spread pass

Input code

No response

Config

No response

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.6.8-nightly-20240706.1&code=H4sIAAAAAAAAAytLLFKoVrA0MDA3tLQ0MjUxNzGwtDTMs1LILFGoVbDFLmeoUGsNAF7PY0A5AAAA&config=H4sIAAAAAAAAA42VS47bMAyG93OKwOtZtIsCgx6gu55BUCzKUSqJhkhlEgxy99KKnUkntNFNEPPjw6R%2Byh8vu113pL77ufuQv%2FIw2kJQ7s9ioUtmexZLB32y1Jcwcve60CNNiEuFZrneQMe2DMAtiH7M3l1EJJi9Z1MKOfjLY7ke01iA6MEmVklXE2SezN5GgtdHVvCd%2Fsnb7HvECDZvEGPJhMwwQNES9xijHQnMyRYly%2FSmtgRCrcQEK4MzY8FR5dkFDpil5jN1YJ3p0YGCQoGewwm0MKklYZmkPaWfhh3s6zC0I%2F4SDScbq2WlJpzbkcjbKlkPGIiNr1kb4Q2uzOAG5%2BF%2BjQzeFOBa8nPcEUNeOZM%2FADKBaImyTaDlbR5e9LQW7TcjQ%2FYiWb4oXOStdZlhkKGaELwy2WkyUDhop1nA1R6myfba68x4ZXwUHBjwXrSipKb3wP1BK8qXEdArQM7Xek1VN2DuW7jCp4XYwL%2BkS9YFNnsky4d1Spe0x7hRIAEf0G04yFEwruMit8R5XOc1OxBpgFNdKjXwfAnIAjCa2O7KJ23IekhGM0Tcf14Ts8P1fgUnm4e27w%2F3JeMY4QRxTcb%2FsSKbVN7tNKl62eyn7YU3TZRWFi98%2F7agpZWX5bc11SV09aGhpsnpUyISSpiP1H16Lp%2BPZXRdoN9L9K3E9S9CLntR5AYAAA%3D%3D

SWC Info output

No response

Expected behavior

No crashes

Actual behavior

No response

Version

https://github.com/swc-project/swc/commit/ da9844b8d56c65f5a0176e3c720e4435694f5756

Additional context

No response

qarmin avatar Jul 11 '24 17:07 qarmin

will investigate it and try to propose a fix

CodeMan62 avatar May 16 '25 13:05 CodeMan62

@kdy1 it seems like i can't find the root cause can you give me a brief idea where this bug is coming from?

CodeMan62 avatar May 23 '25 16:05 CodeMan62

Latest pack of broken files - REPORTS___SWC(1).zip

thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/miette-7.2.0/src/handlers/graphical.rs:1040:22:
Formatting argument out of range
thread 'main' panicked at crates/swc_ecma_parser/src/lexer/token.rs:1061:21:
internal error: entered unreachable code: None
thread 'main' panicked at crates/swc_ecma_compat_es2022/src/class_properties/mod.rs:937:21:
internal error: entered unreachable code: auto_accessor pass should remove this

qarmin avatar Jun 02 '25 11:06 qarmin

@qarmin thanks for this i will take a look asap

CodeMan62 avatar Jun 03 '25 18:06 CodeMan62

2025-10-18 update - thunderbird.tmp.zip

thread 'main' (401746) panicked at /home/runner/work/Automated-Fuzzer/Automated-Fuzzer/swc-main/crates/swc_ecma_lexer/src/common/parser/expr.rs:2006:13:
assertion `left == right` failed
  left: 2
 right: 1
thread 'main' (401734) panicked at /home/runner/work/Automated-Fuzzer/Automated-Fuzzer/swc-main/crates/swc_ecma_lexer/src/common/parser/mod.rs:256:9:
parser should not call bump() without knowing current token
thread 'main' (401809) panicked at crates/swc_ecma_compat_es2022/src/class_properties/mod.rs:947:21:
internal error: entered unreachable code: auto_accessor pass should remove this
stack backtrace:

qarmin avatar Oct 18 '25 06:10 qarmin

cc @bvanjoi Do you have any idea about the lexer one?

kdy1 avatar Oct 18 '25 08:10 kdy1

It would be helpful if there has reproduced code

bvanjoi avatar Oct 18 '25 10:10 bvanjoi

The zip file contains the minimized code necessary to reproduce all reported issues, along with the commands that trigger the problems.

qarmin avatar Oct 18 '25 10:10 qarmin