diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-07-11 14:27:41 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-07-11 14:27:41 -0300 |
| commit | 6955666290c7fd1e74126679441686223804ce06 (patch) | |
| tree | 8e0a80e2eda1a4e286810d229924407bffe0bf5d | |
| parent | 5298392c5ab452706b71a992b17e2a1bb2addde3 (diff) | |
| download | lua-6955666290c7fd1e74126679441686223804ce06.tar.gz lua-6955666290c7fd1e74126679441686223804ce06.tar.bz2 lua-6955666290c7fd1e74126679441686223804ce06.zip | |
'string.byte' gets confused with some out-of-range negative indices +
user-requested GC step may loop forever
| -rw-r--r-- | bugs | 61 |
1 files changed, 59 insertions, 2 deletions
| @@ -1880,8 +1880,8 @@ patch = [[ | |||
| 1880 | +++ lundump.c 2008/04/04 19:51:41 2.7.1.4 | 1880 | +++ lundump.c 2008/04/04 19:51:41 2.7.1.4 |
| 1881 | @@ -1,5 +1,5 @@ | 1881 | @@ -1,5 +1,5 @@ |
| 1882 | /* | 1882 | /* |
| 1883 | -** $Id: lundump.c,v 2.7.1.3 2008/04/04 16:00:45 roberto Exp $ | 1883 | -** $Id: bugs,v 1.96 2008/05/08 16:55:08 roberto Exp roberto $ |
| 1884 | +** $Id: lundump.c,v 2.7.1.4 2008/04/04 19:51:41 roberto Exp $ | 1884 | +** $Id: bugs,v 1.96 2008/05/08 16:55:08 roberto Exp roberto $ |
| 1885 | ** load precompiled Lua chunks | 1885 | ** load precompiled Lua chunks |
| 1886 | ** See Copyright Notice in lua.h | 1886 | ** See Copyright Notice in lua.h |
| 1887 | */ | 1887 | */ |
| @@ -1971,3 +1971,60 @@ patch = [[ | |||
| 1971 | ]], | 1971 | ]], |
| 1972 | } | 1972 | } |
| 1973 | 1973 | ||
| 1974 | |||
| 1975 | Bug{ | ||
| 1976 | what = [['string.byte' gets confused with some out-of-range negative indices]], | ||
| 1977 | report = [[Mike Pall, on 2008/06/03]], | ||
| 1978 | since = [[5.1]], | ||
| 1979 | example = [[ | ||
| 1980 | print(string.byte("abc", -5)) --> 97 98 99 (should print nothing) | ||
| 1981 | ]], | ||
| 1982 | patch = [[ | ||
| 1983 | --- lstrlib.c 2007/12/28 15:32:23 1.132.1.3 | ||
| 1984 | +++ lstrlib.c 2008/07/05 11:53:42 | ||
| 1985 | @@ -35,7 +35,8 @@ | ||
| 1986 | |||
| 1987 | static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) { | ||
| 1988 | /* relative string position: negative means back from end */ | ||
| 1989 | - return (pos>=0) ? pos : (ptrdiff_t)len+pos+1; | ||
| 1990 | + if (pos < 0) pos += (ptrdiff_t)len + 1; | ||
| 1991 | + return (pos >= 0) ? pos : 0; | ||
| 1992 | } | ||
| 1993 | |||
| 1994 | |||
| 1995 | ]], | ||
| 1996 | } | ||
| 1997 | |||
| 1998 | |||
| 1999 | Bug{ | ||
| 2000 | what = [[user-requested GC step may loop forever]], | ||
| 2001 | report = [[Makoto Hamanaka, on 2008/07/01]], | ||
| 2002 | since = [[5.1]], | ||
| 2003 | example = [[ | ||
| 2004 | collectgarbage("setpause", 100) -- small value | ||
| 2005 | collectgarbage("setstepmul", 2000) -- large value | ||
| 2006 | collectgarbage("step",0) | ||
| 2007 | ]], | ||
| 2008 | patch = [[ | ||
| 2009 | --- lapi.c 2008/02/14 16:46:39 2.55.1.4 | ||
| 2010 | +++ lapi.c 2008/07/04 18:34:48 | ||
| 2011 | @@ -929,10 +929,13 @@ | ||
| 2012 | g->GCthreshold = g->totalbytes - a; | ||
| 2013 | else | ||
| 2014 | g->GCthreshold = 0; | ||
| 2015 | - while (g->GCthreshold <= g->totalbytes) | ||
| 2016 | + while (g->GCthreshold <= g->totalbytes) { | ||
| 2017 | luaC_step(L); | ||
| 2018 | - if (g->gcstate == GCSpause) /* end of cycle? */ | ||
| 2019 | - res = 1; /* signal it */ | ||
| 2020 | + if (g->gcstate == GCSpause) { /* end of cycle? */ | ||
| 2021 | + res = 1; /* signal it */ | ||
| 2022 | + break; | ||
| 2023 | + } | ||
| 2024 | + } | ||
| 2025 | break; | ||
| 2026 | } | ||
| 2027 | case LUA_GCSETPAUSE: { | ||
| 2028 | ]], | ||
| 2029 | } | ||
| 2030 | |||
