Skip to content

pax: truncate long names on a UTF-8 char boundary#617

Open
SAY-5 wants to merge 1 commit into
rustcoreutils:mainfrom
SAY-5:fix-pax-multibyte-truncation-panic
Open

pax: truncate long names on a UTF-8 char boundary#617
SAY-5 wants to merge 1 commit into
rustcoreutils:mainfrom
SAY-5:fix-pax-multibyte-truncation-panic

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jul 20, 2026

Copy link
Copy Markdown

Fixes #616.

pax -w panics when a filename longer than 100 bytes has a multi-byte UTF-8 character straddling the 100-byte ustar name boundary, because split_path sliced the path with path_str[..NAME_LEN] on a byte index that is not a char boundary.

The truncation is only the ustar fallback (the full path is preserved in the extended header), so this truncates at the largest char boundary at or below NAME_LEN instead. Added a regression test that reproduces the panic from the issue ('a' + 'Я'*90).

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pax and long file name

1 participant