ericcornelissen/shescape

String like `=~` in Bash not escaped properly by escape(All) with interpolation escaping enabled

Closed this issue · 0 comments

Bug Report

  • Shescape version: v1.5.0
  • Operating system: Unix (Ubuntu 20.04)
  • Shell: Bash

Description

If the string =~ appears at the end of an argument in Bash (without quoting the argument) the tilde (~) will be expanded to the home directory. Similarly, when xxx:~, ~:xxx or xxx:~:xxx appears after = (where xxx can be any string), the tilde (~) will be expanded, this even works for multiple tildes.

Actual Behaviour

When running shescape.escape(All) with interpolation escaping enabled the trailing ~ is not escaped and therefore expanded when the argument is used.

Expected Behaviour

When running shescape.escape(All) with interpolation escaping enabled the trailing ~ should be escaped to avoid it being expanded when the argument is used.

Working Examples

This category of bug was found by fuzzing, the crash results can be found here: