lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 0c258c84927ffe8540fc9590bdce802d598faa6a
parent d57c9cdefc6f00d8bf8bb24b96e65631a1c3ef18
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Thu,  2 Jul 2009 16:57:10 -0300

smart use of varargs may create functions that return too
many arguments and overflow the stack of C functions.

Diffstat:
Mbugs | 24++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/bugs b/bugs @@ -1880,8 +1880,8 @@ patch = [[ +++ lundump.c 2008/04/04 19:51:41 2.7.1.4 @@ -1,5 +1,5 @@ /* --** $Id: bugs,v 1.100 2009/06/15 14:12:59 roberto Exp roberto $ -+** $Id: bugs,v 1.100 2009/06/15 14:12:59 roberto Exp roberto $ +-** $Id: bugs,v 1.101 2009/07/01 21:10:33 roberto Exp roberto $ ++** $Id: bugs,v 1.101 2009/07/01 21:10:33 roberto Exp roberto $ ** load precompiled Lua chunks ** See Copyright Notice in lua.h */ @@ -2193,3 +2193,23 @@ patch = [[ ]], } +But{ +what = [[smart use of varargs may create functions that return too +many arguments and overflow the stack of C functions]], +report = [[Patrick Donnelly, on 2008/12/10]], +since = [[]], +example = [[ +local function lunpack(i, ...) + if i == 0 then return ... + else + return lunpack(i-1, 1, ...) + end +end + +Now, if C calls lunpack(n) with a huge n, it may end with +too many values in its stack and confuse its stack indices. +]], +patch = [[ +]], +} +}