Skip to content

"index out of bounds" panic when using first-class MDX support with an ampersand in an attribute #10130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
shepmaster opened this issue Apr 8, 2025 · 1 comment
Labels
πŸ› Bug βœ–οΈ Non-Parcel bug Bugs related to dependencies or plugins

Comments

@shepmaster
Copy link

πŸ› bug report

Parcel crashes when processing this MDX file:

<img alt="&stuff" />

πŸŽ› Configuration (.babelrc, package.json, cli command)

N/A

πŸ€” Expected Behavior

A proper error message should be printed.

😯 Current Behavior

β ™ Building repro.mdx...

thread '<unnamed>' panicked at /Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/markdown-1.0.0-alpha.21/src/util/character_reference.rs:196:35:
index out of bounds: the len is 6 but the index is 6
stack backtrace:
   0:        0x11bdff240 - _napi_register_module_v1
   1:        0x11be1cfd0 - _napi_register_module_v1
   2:        0x11bdfc19c - _napi_register_module_v1
   3:        0x11bdff0f4 - _napi_register_module_v1
   4:        0x11bdffed0 - _napi_register_module_v1
   5:        0x11bdffcc4 - _napi_register_module_v1
   6:        0x11be0081c - _napi_register_module_v1
   7:        0x11be003c4 - _napi_register_module_v1
   8:        0x11bdff700 - _napi_register_module_v1
   9:        0x11be0007c - _napi_register_module_v1
  10:        0x11be6be7c - _napi_register_module_v1
  11:        0x11be6bffc - _napi_register_module_v1
  12:        0x11b17d6b8 - <unknown>
  13:        0x11b17b484 - <unknown>
  14:        0x11b175bcc - <unknown>
  15:        0x11b1734b0 - <unknown>
  16:        0x11b196528 - <unknown>
  17:        0x11b15be0c - <unknown>
  18:        0x11b0064b8 - <unknown>
  19:        0x11b076090 - <unknown>
  20:        0x11ae68ae4 - <unknown>
  21:        0x11ae5b260 - <unknown>
  22:        0x11be694d8 - _napi_register_module_v1
  23:        0x11bda69d0 - _napi_register_module_v1
  24:        0x11bdac404 - _napi_register_module_v1
  25:        0x11bdaaa14 - _napi_register_module_v1
  26:        0x11be04498 - _napi_register_module_v1
  27:        0x1972c5c0c - __pthread_cond_wait
Rayon: detected unexpected panic; aborting

πŸ’» Code Sample

# Create the project
mkdir repro
cd repro
pnpm init
pnpm add parcel

# Create the MDX file
echo '<img alt="&stuff" />' > repro.mdx

# Build the project
RUST_BACKTRACE=full pnpm parcel build repro.mdx

🌍 Your Environment

Software Version(s)
Parcel 2.14.4
Node v23.10.0, v22.14.0
pnpm 10.7.0
Operating System macOS 15.4 (24E248)
@devongovett
Copy link
Member

The crash appears to be happening within the markdown-rs Rust crate: https://github.com/wooorm/markdown-rs/blob/dcf8a63faca13d291a98d180fae816dea1b6ed81/src/util/character_reference.rs#L196

@devongovett devongovett added πŸ› Bug βœ–οΈ Non-Parcel bug Bugs related to dependencies or plugins labels Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
πŸ› Bug βœ–οΈ Non-Parcel bug Bugs related to dependencies or plugins
Projects
None yet
Development

No branches or pull requests

2 participants