aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-07-02 14:54:23 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-07-02 14:54:23 -0300
commit84ad1eea8165e29e097bb3acd5b262250b551ac4 (patch)
tree3b82c9e22cd4b8cc8139ef1d340cc0e799897dd6
parentb30ec2532c27c572e4fc0da61c8227f8f9e7be7b (diff)
downloadlua-84ad1eea8165e29e097bb3acd5b262250b551ac4.tar.gz
lua-84ad1eea8165e29e097bb3acd5b262250b551ac4.tar.bz2
lua-84ad1eea8165e29e097bb3acd5b262250b551ac4.zip
use of NaN as key breaks some invariants
-rw-r--r--ltable.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ltable.c b/ltable.c
index ba0919f3..baab5ea3 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.111 2002/06/24 20:18:38 roberto Exp roberto $ 2** $Id: ltable.c,v 1.112 2002/07/01 19:31:10 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -468,6 +468,8 @@ TObject *luaH_set (lua_State *L, Table *t, const TObject *key) {
468 return cast(TObject *, p); 468 return cast(TObject *, p);
469 else { 469 else {
470 if (ttype(key) == LUA_TNIL) luaG_runerror(L, "table index is nil"); 470 if (ttype(key) == LUA_TNIL) luaG_runerror(L, "table index is nil");
471 else if (ttype(key) == LUA_TNUMBER && nvalue(key) != nvalue(key))
472 luaG_runerror(L, "table index is NaN");
471 return newkey(L, t, key); 473 return newkey(L, t, key);
472 } 474 }
473} 475}