|
|
|
@ -236,6 +236,7 @@ void LuaPrintStack(lua_State *state) {
|
|
|
|
|
|
|
|
|
|
|
|
int LuaPushStringBuffer(lua_State *luastate, const uint8_t *input, size_t input_len)
|
|
|
|
int LuaPushStringBuffer(lua_State *luastate, const uint8_t *input, size_t input_len)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (input_len % 4 != 0) {
|
|
|
|
/* we're using a buffer sized at a multiple of 4 as lua_pushlstring generates
|
|
|
|
/* we're using a buffer sized at a multiple of 4 as lua_pushlstring generates
|
|
|
|
* invalid read errors in valgrind otherwise. Adding in a nul to be sure.
|
|
|
|
* invalid read errors in valgrind otherwise. Adding in a nul to be sure.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
@ -248,6 +249,9 @@ int LuaPushStringBuffer(lua_State *luastate, const uint8_t *input, size_t input_
|
|
|
|
|
|
|
|
|
|
|
|
/* return value through luastate, as a luastring */
|
|
|
|
/* return value through luastate, as a luastring */
|
|
|
|
lua_pushlstring(luastate, (char *)buf, input_len);
|
|
|
|
lua_pushlstring(luastate, (char *)buf, input_len);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
lua_pushlstring(luastate, (char *)input, input_len);
|
|
|
|
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|