Skip to content

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

@dimaqq

Description

@dimaqq

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()
'😄'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions