mirror of
https://github.com/brazilofmux/tinymux
synced 2026-08-13 00:23:11 -04:00
fix(lua/jit): gate CALL_INT on the int-returning callee whitelist
CALL_STR is chosen when the name is not on the list; CALL_INT must be the dual — only names that claim an integer result — so a string-returning global cannot fall through and emit TY_INT by accident.
This commit is contained in:
parent
5c53532d68
commit
d5e5e86e08
1 changed files with 7 additions and 5 deletions
|
|
@ -2274,13 +2274,15 @@ int hir_lower_lua_proto(hir_program &h, rv_compiler &rc,
|
|||
}
|
||||
}
|
||||
|
||||
// Integer call on a handle from GETFIELD_REF: the narrow
|
||||
// first cut. Integer args, integer result, nothing marshalled.
|
||||
// Everything else falls through to the old path below and
|
||||
// declines, which is what it already did.
|
||||
// Integer result: same argument encoding as CALL_STR, opposite
|
||||
// result type. Gated on the callee whitelist so a string-
|
||||
// returning name that skipped the CALL_STR branch (e.g. nargs 0)
|
||||
// cannot fall through and claim TY_INT.
|
||||
//
|
||||
if (!is_bridge && nresults == 1 && nargs >= 0 && nargs <= 2
|
||||
&& func_reg >= 0
|
||||
&& lua_callable_source(h, func_reg)) {
|
||||
&& lua_callable_source(h, func_reg)
|
||||
&& lua_callee_returns_int(lua_callee_name(h, func_reg))) {
|
||||
int a0 = -1, a1 = -1, kinds = 0;
|
||||
bool ok = true;
|
||||
for (int i = 0; i < nargs && ok; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue