diff options
author | Lua Team <team@lua.org> | 2011-11-24 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2011-11-24 12:00:00 +0000 |
commit | 2e5ae8240bb2daf5d66d69e199de10dde62f5d13 (patch) | |
tree | b9f21bdd5006c59adc99000afa3cf22da8ea1c57 /src/lobject.c | |
parent | c17c598e967843fa77a465caf0e0df15d9019409 (diff) | |
download | lua-github-5.2.0-rc1.tar.gz |
Lua 5.2.0-rc15.2.0-rc1
Diffstat (limited to 'src/lobject.c')
-rw-r--r-- | src/lobject.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lobject.c b/src/lobject.c index d8cc3ce9..148d4bce 100644 --- a/src/lobject.c +++ b/src/lobject.c @@ -1,5 +1,5 @@ /* -** $Id: lobject.c,v 2.52 2011/06/24 12:25:02 roberto Exp $ +** $Id: lobject.c,v 2.53 2011/07/27 12:13:08 roberto Exp $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ @@ -103,8 +103,8 @@ static int isneg (const char **s) { static lua_Number readhexa (const char **s, lua_Number r, int *count) { - while (lisxdigit(cast_uchar(**s))) { /* read integer part */ - r = (r * 16.0) + cast_num(luaO_hexavalue(cast_uchar(*(*s)++))); + for (; lisxdigit(cast_uchar(**s)); (*s)++) { /* read integer part */ + r = (r * 16.0) + cast_num(luaO_hexavalue(cast_uchar(**s))); (*count)++; } return r; @@ -157,7 +157,9 @@ static lua_Number lua_strx2number (const char *s, char **endptr) { int luaO_str2d (const char *s, size_t len, lua_Number *result) { char *endptr; - if (strpbrk(s, "xX")) /* hexa? */ + if (strpbrk(s, "nN")) /* reject 'inf' and 'nan' */ + return 0; + else if (strpbrk(s, "xX")) /* hexa? */ *result = lua_strx2number(s, &endptr); else *result = lua_str2number(s, &endptr); |