Skip to content

Error from swc since version 4.22.1 - when the ៘ is used #5672

Closed
@kfirstri

Description

Rollup Version

4.22.1

Operating System (or Browser)

macos 14.6.1

Node Version (if applicable)

18.16.0

Link To Reproduction

https://rollupjs.org/repl/?version=4.22.4&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIyY29kZSUyMiUzQSUyMmNvbnNvbGUubG9nKCU1QyUyMiVFMSU5RiU5OCU1QyUyMiklM0IlMjIlMkMlMjJpc0VudHJ5JTIyJTNBdHJ1ZSUyQyUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTdEJTVEJTJDJTIyb3B0aW9ucyUyMiUzQSU3QiUyMm91dHB1dCUyMiUzQSU3QiUyMmZvcm1hdCUyMiUzQSUyMmVzJTIyJTdEJTdEJTdE

Expected Behaviour

Rollup should work fine and run file that has this character: ៘

It worked fine in version 4.22.0

Reproduce that works:
https://rollupjs.org/repl/?version=4.22.0&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIyY29kZSUyMiUzQSUyMmNvbnNvbGUubG9nKCU1QyUyMiVFMSU5RiU5OCU1QyUyMiklM0IlMjIlMkMlMjJpc0VudHJ5JTIyJTNBdHJ1ZSUyQyUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTdEJTVEJTJDJTIyb3B0aW9ucyUyMiUzQSU3QiU3RCU3RA==

Actual Behaviour

Ever since version 4.22.1 (and later) - if we have this character (៘) in the file (code or comment) rollup crashes with this error:

thread '<unnamed>' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_common-0.39.0/src/syntax_pos.rs:702:18:
width 3 given for non-narrow character
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at library/core/src/panicking.rs:221:5:
panic in a function that cannot unwind
stack backtrace:
   0:        0x11137fd58 - _napi_register_module_v1
   1:        0x11131d558 - <unknown>
   2:        0x11135d0c8 - _napi_register_module_v1
   3:        0x111380de0 - _napi_register_module_v1
   4:        0x111381f94 - _napi_register_module_v1
   5:        0x111381224 - _napi_register_module_v1
   6:        0x1113811c0 - _napi_register_module_v1
   7:        0x1113811b4 - _napi_register_module_v1
   8:        0x111495850 - _napi_register_module_v1
   9:        0x1114958ac - _napi_register_module_v1
  10:        0x111495864 - _napi_register_module_v1
  11:        0x111316b64 - <unknown>
thread caused non-unwinding panic. aborting.
error Command failed with signal "SIGABRT".

I wanted to add more context to the issue ->

We have a vite project that has a non-direct dependency to fbjs.
One of the files that's being used is UnicodeBidi.js which has the unicode representation of the "៘" character...

vite unescapes unicode to string (security issue that was raised) which eventually brings this character to rollup as a string which makes it crash.

I'm guessing it's related to swc version bump that happened in version 4.22.1 (source)

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions