Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ed: runtime error in edSubstitute() (#577)
* The program crashes when fed unexpected input after the initial "s" command * I found this when investigating a capture-variable-outside-of-condition warning from perlcritic * $char is the 1st character after the "s"; normally it would be "/" as in s/old/new/ * Return early if $args[0] is an empty string * Adding eval guard around the confusing regex constructed from $char prevents the error * Possibly the code could be changed later to enforce that $char is '/' perl ed -p 'ed% ' a.c 63 ed% 1 #include <stdio.h> ed% s*asaaa* Unknown verb pattern '' in regex; marked by <-- HERE in m/((*) <-- HERE [^"*"]*(*)[^"*"]*(*)?)([imsx]*)/ at ed line 519, <> line 2.
- Loading branch information