Skip to content
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

Possibly bad unicode handling in exec() function wrapper #140

Closed
dimaqq opened this issue Jun 22, 2022 · 0 comments · Fixed by #162
Closed

Possibly bad unicode handling in exec() function wrapper #140

dimaqq opened this issue Jun 22, 2022 · 0 comments · Fixed by #162

Comments

@dimaqq
Copy link

dimaqq commented Jun 22, 2022

The code is this:

paths-filter/src/exec.ts

Lines 10 to 11 in 8c7f485

stdout: (data: Buffer) => (stdout += data.toString()),
stderr: (data: Buffer) => (stderr += data.toString())

However, consider that stdout/stderr has fancy Unicode, the data may arrive in chunks, other than the code point boundaries.

toString conversion will then clobber the code points:

> Buffer.from([0xf0, 0x9f]).toString() + Buffer.from([0x98, 0x84]).toString()
'���'
> Buffer.from([0xf0, 0x9f, 0x98, 0x84]).toString()
'😄'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant