diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-11-10 17:38:12 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-11-10 17:38:12 -0200 |
| commit | a84bca67fcf74241570d7f6d51243aecce9e71a6 (patch) | |
| tree | 23001359b65f1a7a656d2d4d998b9c0e5b816ecb | |
| parent | 4ccfb2f9bc1db4457f27a63997d869e995292cc6 (diff) | |
| download | lua-a84bca67fcf74241570d7f6d51243aecce9e71a6.tar.gz lua-a84bca67fcf74241570d7f6d51243aecce9e71a6.tar.bz2 lua-a84bca67fcf74241570d7f6d51243aecce9e71a6.zip | |
bug: gsub/strfind do not check whether captures are properly finished.
| -rw-r--r-- | bugs | 4 | ||||
| -rw-r--r-- | lstrlib.c | 9 |
2 files changed, 10 insertions, 3 deletions
| @@ -48,3 +48,7 @@ Mon May 18 19:20:00 EST 1998 | |||
| 48 | Mon Sep 7 15:57:02 EST 1998 | 48 | Mon Sep 7 15:57:02 EST 1998 |
| 49 | >> function "luaL_argerror" prints wrong argument number (from a user's point | 49 | >> function "luaL_argerror" prints wrong argument number (from a user's point |
| 50 | of view) when functions have upvalues. | 50 | of view) when functions have upvalues. |
| 51 | |||
| 52 | ** lstrlib.c | ||
| 53 | Tue Nov 10 17:29:36 EDT 1998 | ||
| 54 | >> gsub/strfind do not check whether captures are properly finished. | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstrlib.c,v 1.18 1998/07/01 14:21:57 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.19 1998/07/12 16:13:45 roberto Exp roberto $ |
| 3 | ** Standard library for strings and pattern-matching | 3 | ** Standard library for strings and pattern-matching |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -138,8 +138,11 @@ struct Capture { | |||
| 138 | static void push_captures (struct Capture *cap) | 138 | static void push_captures (struct Capture *cap) |
| 139 | { | 139 | { |
| 140 | int i; | 140 | int i; |
| 141 | for (i=0; i<cap->level; i++) | 141 | for (i=0; i<cap->level; i++) { |
| 142 | lua_pushlstring(cap->capture[i].init, cap->capture[i].len); | 142 | int l = cap->capture[i].len; |
| 143 | if (l == -1) lua_error("unfinished capture"); | ||
| 144 | lua_pushlstring(cap->capture[i].init, l); | ||
| 145 | } | ||
| 143 | } | 146 | } |
| 144 | 147 | ||
| 145 | 148 | ||
