From c2680687d148820847607e13ed7100e60d94c79e Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 19 Jul 2019 16:55:37 -0300 Subject: Bug: IBackCommit must remove dynamic captures, too Like a fail, a IBackCommit instruction must remove any dynamic capture made inside an 'and' pattern. (The added test for this problem needs assertions on to detect the bug.) --- lpvm.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lpvm.c') diff --git a/lpvm.c b/lpvm.c index dbe1a8e..af9e617 100644 --- a/lpvm.c +++ b/lpvm.c @@ -320,6 +320,8 @@ const char *match (lua_State *L, const char *o, const char *s, const char *e, case IBackCommit: { assert(stack > getstackbase(L, ptop) && (stack - 1)->s != NULL); s = (--stack)->s; + if (ndyncap > 0) /* are there matchtime captures? */ + ndyncap -= removedyncap(L, capture, stack->caplevel, captop); captop = stack->caplevel; p += getoffset(p); continue; -- cgit v1.2.3-55-g6feb