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/LuaWrapper.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/LuaWrapper.cpp')
| -rw-r--r-- | library/LuaWrapper.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/LuaWrapper.cpp b/library/LuaWrapper.cpp index 7c15a27a..9f2fc2f1 100644 --- a/library/LuaWrapper.cpp +++ b/library/LuaWrapper.cpp @@ -715,7 +715,7 @@ static int meta_reinterpret_cast(lua_State *state) if (lua_isnil(state, 2)) ptr = NULL; else if (lua_isnumber(state, 2)) - ptr = (void*)lua_tointeger(state, 2); + ptr = (void*)lua_tounsigned(state, 2); else { ptr = get_object_internal(state, NULL, 2, false, true); |
