From cf1705c1d96b549ef5887a2bc3038dbc31912e50 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 7 Jun 2023 15:41:01 -0300 Subject: Captures point to string positions using indices That uses 4 bytes (uint) instead of 8 (char*); the size of the structure 'Capture' reduces from 16 to 8 bytes in 64-bit machines. --- lptree.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lptree.c') diff --git a/lptree.c b/lptree.c index 330471a..475b0c3 100644 --- a/lptree.c +++ b/lptree.c @@ -1253,6 +1253,7 @@ static int lp_match (lua_State *L) { const char *s = luaL_checklstring(L, SUBJIDX, &l); size_t i = initposition(L, l); int ptop = lua_gettop(L); + luaL_argcheck(L, l < MAXINDT, SUBJIDX, "subject too long"); lua_pushnil(L); /* initialize subscache */ lua_pushlightuserdata(L, capture); /* initialize caplistidx */ lua_getuservalue(L, 1); /* initialize ktableidx */ -- cgit v1.2.3-55-g6feb