From 84ad1eea8165e29e097bb3acd5b262250b551ac4 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 2 Jul 2002 14:54:23 -0300 Subject: use of NaN as key breaks some invariants --- ltable.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ltable.c') diff --git a/ltable.c b/ltable.c index ba0919f3..baab5ea3 100644 --- a/ltable.c +++ b/ltable.c @@ -1,5 +1,5 @@ /* -** $Id: ltable.c,v 1.111 2002/06/24 20:18:38 roberto Exp roberto $ +** $Id: ltable.c,v 1.112 2002/07/01 19:31:10 roberto Exp roberto $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -468,6 +468,8 @@ TObject *luaH_set (lua_State *L, Table *t, const TObject *key) { return cast(TObject *, p); else { if (ttype(key) == LUA_TNIL) luaG_runerror(L, "table index is nil"); + else if (ttype(key) == LUA_TNUMBER && nvalue(key) != nvalue(key)) + luaG_runerror(L, "table index is NaN"); return newkey(L, t, key); } } -- cgit v1.2.3-55-g6feb