From a84bca67fcf74241570d7f6d51243aecce9e71a6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 10 Nov 1998 17:38:12 -0200 Subject: bug: gsub/strfind do not check whether captures are properly finished. --- lstrlib.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lstrlib.c') diff --git a/lstrlib.c b/lstrlib.c index bd0f0296..fdb90deb 100644 --- a/lstrlib.c +++ b/lstrlib.c @@ -1,5 +1,5 @@ /* -** $Id: lstrlib.c,v 1.18 1998/07/01 14:21:57 roberto Exp roberto $ +** $Id: lstrlib.c,v 1.19 1998/07/12 16:13:45 roberto Exp roberto $ ** Standard library for strings and pattern-matching ** See Copyright Notice in lua.h */ @@ -138,8 +138,11 @@ struct Capture { static void push_captures (struct Capture *cap) { int i; - for (i=0; ilevel; i++) - lua_pushlstring(cap->capture[i].init, cap->capture[i].len); + for (i=0; ilevel; i++) { + int l = cap->capture[i].len; + if (l == -1) lua_error("unfinished capture"); + lua_pushlstring(cap->capture[i].init, l); + } } -- cgit v1.2.3-55-g6feb