Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: pattern incremental search



On 12/20/21, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> On 4/26/08, Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
>> -    if (replstr) {
>> +    if (replstr || (fl & SUB_LIST)) {
> Someone in the irc channel reported a crash on this strlen when doing
> history-incremental-pattern-search-backward with any search, and they
> can reproduce it with the latest git version too, they posted this
> backtrace:

That extra test doesn't look like it makes any sense --- I think it
may just be in completely the wrong place and shouldn't be in
get_match_ret() at all since it's similar to some checks in other
places where we allow zero-length (but not NULL) strings for some
edge cases in some variants of matching.  We should probably
just remove it and see what happens.

pws

diff --git a/Src/glob.c b/Src/glob.c
index bee890caf..375671cea 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -2549,7 +2549,7 @@ get_match_ret(Imatchdata imd, int b, int e)
     e += add;
 
     /* Everything now refers to metafied lengths. */
-    if (replstr || (fl & SUB_LIST)) {
+    if (replstr) {
 	if (fl & SUB_DOSUBST) {
 	    replstr = dupstring(replstr);
 	    singsub(&replstr);




Messages sorted by: Reverse Date, Date, Thread, Author