summaryrefslogtreecommitdiff
path: root/bugs
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2007-10-29 13:51:10 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2007-10-29 13:51:10 -0200
commitc06cc609466d4527848bbf87268ec714942d554a (patch)
tree34fa2d66dfaf077ab194a9b1c997a5deeb1910e9 /bugs
parent2fa476655fb1a733bcf8c408f14103bd7abed1b8 (diff)
downloadlua-c06cc609466d4527848bbf87268ec714942d554a.tar.gz
lua-c06cc609466d4527848bbf87268ec714942d554a.tar.bz2
lua-c06cc609466d4527848bbf87268ec714942d554a.zip
BUG: 'gsub' may go wild when wrongly called without its third
> argument and with a large subject.
Diffstat (limited to 'bugs')
-rw-r--r--bugs31
1 files changed, 31 insertions, 0 deletions
diff --git a/bugs b/bugs
index 6743c41e..b9015051 100644
--- a/bugs
+++ b/bugs
@@ -1539,6 +1539,37 @@ lua.c:
1539} 1539}
1540 1540
1541Bug{ 1541Bug{
1542what = [['gsub' may go wild when wrongly called without its third
1543argument and with a large subject]],
1544report = [[Florian Berger, on 10/2007]],
1545since = [[5.1]],
1546example = [[
1547x = string.rep('a', 10000) .. string.rep('b', 10000)
1548print(#string.gsub(x, 'b'))
1549]],
1550patch = [[
1551lstrlib.c:
1552@@ -631,6 +631,2 @@
1553 }
1554- default: {
1555- luaL_argerror(L, 3, "string/function/table expected");
1556- return;
1557- }
1558 }
1559@@ -650,2 +646,3 @@
1560 const char *p = luaL_checkstring(L, 2);
1561+ int tr = lua_type(L, 3);
1562 int max_s = luaL_optint(L, 4, srcl+1);
1563@@ -655,2 +652,5 @@
1564 luaL_Buffer b;
1565+ luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING ||
1566+ tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3,
1567+ "string/function/table expected");
1568 luaL_buffinit(L, &b);
1569]],
1570}
1571
1572Bug{
1542what = [[ ]], 1573what = [[ ]],
1543report = [[ , on ]], 1574report = [[ , on ]],
1544since = [[i ]], 1575since = [[i ]],