mirror of https://github.com/mgba-emu/mgba.git
Script: Fix table string key UAF
This commit is contained in:
parent
5a5adc1b15
commit
e445baaf14
|
@ -584,7 +584,11 @@ struct mScriptValue* _luaCoerceTable(struct mScriptEngineContextLua* luaContext)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mScriptTableInsert(table, key, value);
|
mScriptTableInsert(table, key, value);
|
||||||
mScriptValueDeref(key);
|
if (key->type != mSCRIPT_TYPE_MS_STR) {
|
||||||
|
// Strings are added to the ref pool, so we need to keep it
|
||||||
|
// ref'd to prevent it from being collected prematurely
|
||||||
|
mScriptValueDeref(key);
|
||||||
|
}
|
||||||
mScriptValueDeref(value);
|
mScriptValueDeref(value);
|
||||||
}
|
}
|
||||||
lua_pop(luaContext->lua, 1);
|
lua_pop(luaContext->lua, 1);
|
||||||
|
|
Loading…
Reference in New Issue