ericcornelissen/shescape

Incomplete escaping of characters following U+0085 for PowerShell

ericcornelissen opened this issue · 0 comments

Bug Report

  • Shescape version: v1.5.8
  • Operating system: Windows 10
  • Shell: PowerShell

Description

Escaping of certain characters for PowerShell doesn't happen when they're preceded by the character U+0085. This concerns the characters found here:

shescape/src/win.js

Lines 68 to 69 in 4508953

.replace(/(^|\s)((?:\*|[1-6])?)(>)/g, "$1$2`$3")
.replace(/(^|\s)(<|@|#|-|\:|\])/g, "$1`$2")

Actual Behaviour

The relevant characters are not escaped and lead to unexpected outputs. So far, it seems this leads to either incomplete arguments or crashes.

Expected Behaviour

The relevant characters should be escaped and arguments should be complete and not cause crashes.

Working Example

  1. Checkout at the correct commit using git checkout v1.5.8
  2. Download and extract crash-89cf01d2aab23094d05da090514360411e4963414f1e86912c21173ef527d5be.zip
  3. Add it to the fuzz corpus
  4. Run npm run fuzz -- exec with PowerShell configured as the fuzz shell.
  5. A crash should occur for crash-89cf01d2aab23094d05da090514360411e4963414f1e86912c21173ef527d5be