diff options
-rw-r--r-- | bugs | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -3460,6 +3460,41 @@ patch = [[ | |||
3460 | 3460 | ||
3461 | --[=[ | 3461 | --[=[ |
3462 | Bug{ | 3462 | Bug{ |
3463 | what = [['io.lines' does not check maximum number of options]], | ||
3464 | report = [[Patrick Donnell, 2015/07/10]], | ||
3465 | since = [[3.0]], | ||
3466 | fix = nil, | ||
3467 | example = [[ | ||
3468 | -- can segfault in some machines | ||
3469 | t ={}; for i = 1, 253 do t[i] = 1 end | ||
3470 | io.lines("someexistingfile", table.unpack(t))() | ||
3471 | ]], | ||
3472 | patch = [[ | ||
3473 | --- liolib.c 2015/07/07 17:03:34 2.146 | ||
3474 | +++ liolib.c 2015/07/15 14:40:28 2.147 | ||
3475 | @@ -318,8 +318,15 @@ | ||
3476 | static int io_readline (lua_State *L); | ||
3477 | |||
3478 | |||
3479 | +/* | ||
3480 | +** maximum number of arguments to 'f:lines'/'io.lines' (it + 3 must fit | ||
3481 | +** in the limit for upvalues of a closure) | ||
3482 | +*/ | ||
3483 | +#define MAXARGLINE 250 | ||
3484 | + | ||
3485 | static void aux_lines (lua_State *L, int toclose) { | ||
3486 | int n = lua_gettop(L) - 1; /* number of arguments to read */ | ||
3487 | + luaL_argcheck(L, n <= MAXARGLINE, MAXARGLINE + 2, "too many arguments"); | ||
3488 | lua_pushinteger(L, n); /* number of arguments to read */ | ||
3489 | lua_pushboolean(L, toclose); /* close/not close file when finished */ | ||
3490 | lua_rotate(L, 2, 2); /* move 'n' and 'toclose' to their positions */ | ||
3491 | ]] | ||
3492 | } | ||
3493 | ]=] | ||
3494 | |||
3495 | |||
3496 | --[=[ | ||
3497 | Bug{ | ||
3463 | what = [[ ]], | 3498 | what = [[ ]], |
3464 | report = [[ ]], | 3499 | report = [[ ]], |
3465 | since = [[ ]], | 3500 | since = [[ ]], |