fix ambiguous submatches

This commit is contained in:
Kyryl Melekhin
2021-08-10 10:33:04 +00:00
parent e44e6a9517
commit 6a3be3927e
3 changed files with 57 additions and 12 deletions

5
pike.c
View File

@@ -576,10 +576,11 @@ int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)
npc += *(npc+1) * 2 + 2;
goto addthread;
case MATCH:
if (matched)
if (matched) {
decref(matched)
subidx = 0;
}
matched = nsub;
subidx = 0;
goto break_for;
}
decref(nsub)