diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-07-02 14:54:23 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-07-02 14:54:23 -0300 |
commit | 84ad1eea8165e29e097bb3acd5b262250b551ac4 (patch) | |
tree | 3b82c9e22cd4b8cc8139ef1d340cc0e799897dd6 | |
parent | b30ec2532c27c572e4fc0da61c8227f8f9e7be7b (diff) | |
download | lua-84ad1eea8165e29e097bb3acd5b262250b551ac4.tar.gz lua-84ad1eea8165e29e097bb3acd5b262250b551ac4.tar.bz2 lua-84ad1eea8165e29e097bb3acd5b262250b551ac4.zip |
use of NaN as key breaks some invariants
-rw-r--r-- | ltable.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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 | } |