String like `=~` in Bash not escaped properly by escape(All) with interpolation escaping enabled
Closed this issue · 0 comments
ericcornelissen commented
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:
- fuzz-crash-ubuntu-latest-d064460acb19928e9d39d88104d3babbac73b8c3.zip
- fuzz-crash-ubuntu-latest-3f7da262eedcbbafb9fa6c88a73f27ccad35541e.zip
- fuzz-crash-ubuntu-latest-d9afe26e335c8ec19274bf4a631cdce570169161.zip
- fuzz-crash-ubuntu-latest-71ebbf663da3b83efd509e136ab3424293fa42bd.zip
- fuzz-crash-ubuntu-latest-bff706bd1435d57c3d433d63d50f7e2f7e87f4f4.zip
- fuzz-crash-ubuntu-latest-50ab31df9b55f3b4953d5db689c25cdef1014e40.zip
- fuzz-crash-ubuntu-latest-18410404c15407d04365ed5149d537e6d222b172.zip