configuration for NaN trick big-endian + macro 'luai_checknum' to

ensure numbers comming from C are not "improper" (some kinds of
signaling NaNs)
This commit is contained in:
Roberto Ierusalimschy
2011-06-13 11:13:06 -03:00
parent f62565abea
commit fd80e63468
3 changed files with 50 additions and 7 deletions

4
lapi.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 2.147 2011/05/31 18:27:56 roberto Exp roberto $
** $Id: lapi.c,v 2.148 2011/06/02 19:31:40 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -463,6 +463,8 @@ LUA_API void lua_pushnil (lua_State *L) {
LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
lua_lock(L);
setnvalue(L->top, n);
luai_checknum(L, L->top,
luaG_runerror(L, "C API - attempt to push a signaling NaN"));
api_incr_top(L);
lua_unlock(L);
}