Skip to content

fix(minifier): use UTF-16 indices for string folding - #25163

Closed
subotac wants to merge 1 commit into
oxc-project:mainfrom
subotac:fix/minifier-string-utf16-indices
Closed

subotac wants to merge 1 commit into
oxc-project:mainfrom
subotac:fix/minifier-string-utf16-indices

Conversation

@subotac

@subotac subotac commented Jul 31, 2026

Copy link
Copy Markdown

Fixes #25158.

Use UTF-16 code unit offsets when folding indexOf, lastIndexOf, substring, and slice. This also applies the missing-search-string coercion and the special lastIndexOf handling for NaN/
undefined positions.

Folding is skipped when a substring boundary would produce an unpaired surrogate that cannot be represented by a Rust string. Regression coverage includes Latin-1, CJK, astral characters, omitted arguments,
and non finite positions

@subotac
subotac requested a review from Dunqing as a code owner July 31, 2026 19:51
@camc314 camc314 added the A-minifier Area - Minification, compression and name mangling, oxc_minifier / oxc_mangler label Aug 1, 2026
@camc314

camc314 commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Hi! Thanks for working on this. This will be fixed by #26548

@camc314 camc314 closed this Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minification, compression and name mangling, oxc_minifier / oxc_mangler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

minify: String.prototype constant folding emits incorrect values for non-ASCII strings and for omitted / NaN arguments

2 participants