Skip to content

Commit

Permalink
fix(scripting/lua): don't zero out 'equal' vector results
Browse files Browse the repository at this point in the history
This regressed a while ago when mitigation for result abuse was added.

Somehow, this was only recently conclusively reported by a user on the
forums: https://forum.cfx.re/t/4851998

This is fixed by ignoring vector results for clearing.
  • Loading branch information
blattersturm committed May 12, 2022
1 parent 25984c7 commit 8d45baa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions code/components/citizen-scripting-lua/src/LuaScriptNatives.cpp
Expand Up @@ -666,9 +666,13 @@ static int __Lua_InvokeNative(lua_State* L)
}

// if any result is requested and there was *no* change, zero out
context.arguments[1] = 0;
context.arguments[2] = 0;
context.arguments[3] = 0;
// *unless this is a vector result
if (result.returnValueCoercion != LuaMetaFields::ResultAsVector)
{
context.arguments[1] = 0;
context.arguments[2] = 0;
context.arguments[3] = 0;
}
}
}
#endif
Expand Down

0 comments on commit 8d45baa

Please sign in to comment.