diff options
| author | Alexander Gavrilov | 2012-06-16 17:09:58 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-06-16 17:09:58 +0400 |
| commit | 927ce6ce5adf019fd4f5fe18024b4f1b4c17fc20 (patch) | |
| tree | 64d1e934bc63db89a813af49805a082fac91c7bb /library/LuaApi.cpp | |
| parent | db91850464a98e785ff53cfdc5df46b10229cfdb (diff) | |
| download | dfhack-927ce6ce5adf019fd4f5fe18024b4f1b4c17fc20.tar.gz dfhack-927ce6ce5adf019fd4f5fe18024b4f1b4c17fc20.tar.bz2 dfhack-927ce6ce5adf019fd4f5fe18024b4f1b4c17fc20.tar.xz | |
Fix a problem with number to address cast for high-half addresses.
If the address is out of the signed int range, lua_tointeger produces
unspecified result. lua_tounsigned is guaranteed to wrap.
Diffstat (limited to 'library/LuaApi.cpp')
| -rw-r--r-- | library/LuaApi.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 50458f11..cdfd4789 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -1028,7 +1028,7 @@ static void *checkaddr(lua_State *L, int idx, bool allow_null = false) if (lua_isnil(L, idx)) rv = NULL; else if (lua_type(L, idx) == LUA_TNUMBER) - rv = (void*)lua_tointeger(L, idx); + rv = (void*)lua_tounsigned(L, idx); else rv = Lua::CheckDFObject(L, NULL, idx); if (!rv && !allow_null) |
