diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-05-02 15:32:22 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-05-02 15:32:22 -0300 |
commit | fe5c37ae95ac64762f307d983000246e3429017f (patch) | |
tree | 2e35f41aa4d9fb697bc3c3a8d51651ca82671a57 | |
parent | c31f02948fb4431e2639948557dc5501fa1877b9 (diff) | |
download | lua-fe5c37ae95ac64762f307d983000246e3429017f.tar.gz lua-fe5c37ae95ac64762f307d983000246e3429017f.tar.bz2 lua-fe5c37ae95ac64762f307d983000246e3429017f.zip |
BUG: `strfind' gets wrong subject length when there is an offset
-rw-r--r-- | bugs | 5 | ||||
-rw-r--r-- | lstrlib.c | 4 |
2 files changed, 7 insertions, 2 deletions
@@ -170,3 +170,8 @@ in the following platforms: | |||
170 | * IRIX - cc, cc-purify | 170 | * IRIX - cc, cc-purify |
171 | * Windows - Visual C++ (.c e .cpp, warning level=4) | 171 | * Windows - Visual C++ (.c e .cpp, warning level=4) |
172 | 172 | ||
173 | |||
174 | ** lstrlib.c | ||
175 | Tue May 2 15:27:58 EST 2000 | ||
176 | >> `strfind' gets wrong subject length when there is an offset | ||
177 | (by Jon Kleiser; since 4.0a) | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.40 2000/02/08 16:34:31 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.41 2000/03/03 14:58:26 roberto Exp roberto $ |
3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -405,7 +405,7 @@ static void str_find (lua_State *L) { | |||
405 | luaL_arg_check(L, 0 <= init && init <= l1, 3, "out of range"); | 405 | luaL_arg_check(L, 0 <= init && init <= l1, 3, "out of range"); |
406 | if (lua_getparam(L, 4) != LUA_NOOBJECT || | 406 | if (lua_getparam(L, 4) != LUA_NOOBJECT || |
407 | strpbrk(p, SPECIALS) == NULL) { /* no special characters? */ | 407 | strpbrk(p, SPECIALS) == NULL) { /* no special characters? */ |
408 | const char *s2 = memfind(s+init, l1, p, l2); | 408 | const char *s2 = memfind(s+init, l1-init, p, l2); |
409 | if (s2) { | 409 | if (s2) { |
410 | lua_pushnumber(L, s2-s+1); | 410 | lua_pushnumber(L, s2-s+1); |
411 | lua_pushnumber(L, s2-s+l2); | 411 | lua_pushnumber(L, s2-s+l2); |