-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lua-seri bug #28
Comments
谢谢, 一并修改了另一个类似的地方. |
这个 bug 在 https://github.com/cloudwu/lua-serialize 这个子项目中, 三月的时候就修复了. 一直没有合并到这里来 >< |
Closed
Closed
Closed
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
把config里的harbor设置为大于127之后,程序在执行到main.lua中 skynet.monitor "simplemonitor"的时候会挂起,跟踪后发现是lua-seri 模块对unsigned integer类型处理不正确引起的:
lua-seri.c:337
case LUA_TNUMBER: {
lua_Integer x = lua_tointeger(L,index);
lua_Number n = lua_tonumber(L,index);
if ((lua_Number)x==n) {
wb_integer(b, x, TYPE_NUMBER);
} else {
wb_number(b,n);
}
lua_integer被定义为ptrdiff_t(在64位机器上为 long int),在类型转换后x==n会成立,从而把unsigned integer当成signed integer处理。
patch:
lua_Integer x = lua_tointeger(L,index); -> int32_t x = (int32_t)lua_tointeger(L,index);
The text was updated successfully, but these errors were encountered: