summaryrefslogtreecommitdiffstats
path: root/patches/lua-5.1.4/0005-debug.getfenv-does-not-check-whether-it-has-an-argum.patch
blob: 40c0e3f51c4865232b4fade452f14330d4a214ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From: =?UTF-8?q?Beno=C3=AEt=20Burnichon?= <benoit.burnichon@airtag.com>
Date: Tue, 6 Dec 2011 14:18:20 +0100
Subject: [PATCH] debug.getfenv does not check whether it has an argument.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Comes from http://www.lua.org/bugs.html#5.1.4-5

reported by Patrick Donnelly on 30 Jul 2009.
Example:
 --
 debug.getfenv()   -- should raise an error
 --

Signed-off-by: Benoît Burnichon <benoit.burnichon@airtag.com>
---
 src/ldblib.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/ldblib.c b/src/ldblib.c
index 67de122..21116ac 100644
--- a/src/ldblib.c
+++ b/src/ldblib.c
@@ -45,6 +45,7 @@ static int db_setmetatable (lua_State *L) {
 
 
 static int db_getfenv (lua_State *L) {
+  luaL_checkany(L, 1);
   lua_getfenv(L, 1);
   return 1;
 }